[Zope3-Users] Zope 3 Theory: Addform and Objects
djohnson at jsatech.com
Wed Nov 29 14:02:36 EST 2006
I am creating a custom content container and am getting the intricacies of
the addform browser zcml directive. When I add an object in the ZMI to my
custom container I notice that the __setitem__() method is called after I
hit "Add" button. I also see how the set_before_add and set_after_add
options are used.
I notice that when the container's __setitem__ method is called with the new
object, the attributes are not set. When do the attributes get set?
In the editform directive this issue is resolved by providing a class and an
update() method. I can be notified after the attributes have been changed
so that I can perform my custom handling.
However, how is custom handling done in addform? I could specify all the
fields in the "set_before_add" option, but this is tedious and does not work
well if the schema changes (because I have to remember to update the ZCML as
My motive is that I'm creating content objects which will be stored in a
MySQL database. When the objects are added through the ZMI I want to issue
an update statement to the database with the newly added objects attributes.
Hopefully I'm making some sense.
Warm regards. Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Zope3-users