[Zope] Editing ZClasses - Hole in Documentation

Douwe Osinga dmo@oberon.nl
Fri, 16 Nov 2001 11:02:51 +0100


Hi Casey,

I encountered the same problem starting with Zope. ZClasses seem the obvious
vehicel for encapsulating reusable functionality, but there are so many
possibilities of doing things that it is rather unclear to me what would be
the best way to do things. Maybe there is a need for some kind of best
practices document.

When I started with ZClasses, I stored all my properties in Property sheets,
which is good because the property sheets are inherited by the instances of
the class, so adding a new property to the class, automatically adds it to
your instance, but I found it very akward to work with. The code that
handles form posts and retrieval of values had to know about them.

Currently I have one DTML-form for every z-class defining all *properties*
of this class. This DTML-form is used for the new operation and the edit
operation. I created a little python script called widget, which is passed
the name and type of field and looks up the value of this property in the
context and request. Another python method handles the post and creates a
new object or edits it.

This works for me and allows me to create editable objects by defining the
main edit document. I would be very interested to know how other people
handle this specific problem.

Douwe