[Grok-dev] Re: applyChanges and add forms
Philipp von Weitershausen
philipp at weitershausen.de
Mon Apr 16 16:57:15 EDT 2007
Philipp von Weitershausen wrote:
>>>> We need to verify what happens with the applyChanges return value
>>>> right now. We also need to study what triggers the ObjectModified
>>> Yes. Calling the applyChanges method currently sends the
>>> ObjectModified event and it returns a boolean value which indicates
>>> whether the object was changed at all.
>> Do we want to do that in AddForm at all? AddForm after all creates the
>> object and already (presumably) triggers an IObjectAdded event. Doing
>> an IObjectModified event straight afterward would be doing things
>> twice. Sounds like applyData in add forms want to do the real minimum
>> to just set attributes based on the schema.
I just realized that it would be useful to have applyData send an
IObjectModifiedEvent all the time. Let's say you have the following add
def add(self, **data):
self.context['ellie'] = ellie = Mammoth()
The first line of the method body would trigger an IObjectAddedEvent,
causing the object to be added to a catalog index, for example. The
second line would modify the object, but not send an appropriate event
to update the index.
I think we want to send that event.
http://worldcookery.com -- Professional Zope documentation and training
More information about the Grok-dev