[Zope] overriding __str__ method?

Seb Bacon sebbacon@email.com
Sun, 8 Oct 2000 19:23:45 +0100


Hi,

What I'd really like to do is have inline content-management.  I don't know
if I'm completely up the wrong tree, and some advice would be much
appreciated.

My reason:
Correct me if I'm wrong, but the zope security model does not allow me
exclude an authenticated user from knowing that an application-logic object
(e.g. 'view_status') exists, when she's in the 'manage' interface.  This
means she gets to see lots of horrible things which it would be better to
hide from her.  Apart from that, the whole interface-skinning project
doesn't seem to have happened yet, and I think the present interface is a
bit ugly.

My strategy:
Each element that I want the user to be able to edit is a ZClass with a
manage_content method.  This provides the custom management view (e.g.
combines properties and title/data into a single form).
Now I want a way to give the user access to this screen.  I could do a new
version of the folders tree view (manage_menu), but what I'd really like to
do is have a button next to each of these elements ("edit this") which calls
its manage_content method.  The button would only appear when the user was
authenticated / authorised.

My problem:
The only place I can think of doing this is in each object's __str__ method.
But AFAIK there's no convenient way of overriding its default behaviour.
What I'd like to do is override it in the ZClass views interface.  I can
override the 'View' method (from the ZClass 'views' tab), but that doesn't
get called in the course of rendering a component in a page.  The problem
would seem to be that there's no equivalent of the __str__ method available
to override...  Or is there?

Otherwise, I suppose I'd have to edit each object type's __str__ method
directly. Or patch the publishing mechanism, but I've not had the guts to
look at that yet. yuk.  I'd rather not.

Can anyone shed any light?  Cheers,

seb