Marco Mariani wrote:
> I've never used events.
> I've subscribed to modification events on my objects:
>   <subscriber for=".interfaces.IMyObject
>                    zope.lifecycleevent.interfaces.IObjectModifiedEvent"
>               handler=".events.modifiedObject" />
> Unfortunately, modifiedObject() only gets called when new children are
> inserted (IMyObject provides IContainer)
> I do NOT get an event for changing an attribute on a MyObject instance
> or for trying the same on other objects that do not implement IContainer.

Right, because you aren't sending the event. Zope does NOT automagically
send events when you change an attribute of an object. THis is how you
would send an IObjectModifiedEvent manually:

  >>> from zope.lifecycleevent.interfaces import ObjectModifiedEvent
  >>> from zope.event import notify
  >>> notify(ObjectModifiedEvent(myobj))

This is, btw, exactly what the container machinery is doing when you add
a child to a container. It's also what the form machinery does when it
changes an object as the result of an automated add or edit form.


Zope3-users mailing list

Reply via email to