[Zope3-Users] NameChooser, ZCML, and set_before_add
Stephan Richter
srichter at cosmos.phy.tufts.edu
Mon Feb 6 07:02:46 EST 2006
On Sunday 22 January 2006 18:03, David Johnson wrote:
> I'm implemented NameChooser similarly to Phillip's book. It works great
> except when I edit - name changes do not take effect. For example, if I
> added an object with a name like "BBQ", and then later edit it and change
> it to "BBQ Chicken", the name of the object stays "BBQ", although the name
> attribute becomes "BBQ Chicken".
The namechooser is *only* invoked during *adding*.
> When a form is added, the ZCML directive "set_before_add" works. Is there a
> similar one for "browser:editform"? Is there another approach that is
> recommended?
The right way to handle this is to have a subscriber that listens to
IObjectAddedEvent events and if the name changes, you basically do also a
move from the old __name__ to a new computed one.
Regards,
Stephan
--
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
More information about the Zope3-users
mailing list