Michael Kerrin wrote:
Log message for revision 72694:
Emit an ObjectModifiedEvent on successfully modifying a property with
the proppatch method.
+ if changed:
Just emitting an ObjectModifiedEvent like that is pretty useless, IMO.
With this you have no clue
- whether the object or the object's annotations were modified
- which properties of which schema were modified.
The good news is that the ObjectModifiedEvent API actually supports this
kind of stuff, you just need to use it:
info = Attributes(ITheSchema, 'foo', 'bar', 'blergh')
(Attributes is importable from zope.lifecycleevent). Note that the
object must not necessarily provide ITheSchema, it could also be that
the ITheSchema(obj) adapter was changed (this is useful when sending
modified events for annotation adapters like IZopeDublinCore).
Unfortunately, not many places in Zope 3 itself are good examples of
this. In fact, not even formlib sends this extra information along with
the events, something I've been meaning to report and fix. (Thanks for
reminding me to do so :)).
http://worldcookery.com -- Professional Zope documentation and training
Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5
Zope3-dev mailing list