On Aug 17, 2007, at 5:29 PM, Chris Withers <[EMAIL PROTECTED]> wrote:

Martin Aspeli wrote:
def handler(event):
   if IContainerModifiedEvent.providedBy(event):

...which is pretty inefficient.

All the subscriber lookup, etc, has to happen to get this far.

There must be a better way..


a container is an object.

It's being modified by the sake of its content changing.

So it makes sense that a container modified event is a specialized extension of object modified.

Better way? The only better way, really, would be doing a re-dispatch. Or fire off your own event when you modify other properties on a container.

Or kick all of the code that sends modified events so that they send along descriptions of what has changed. Sometimes I want to respond only when a Dublin core element has changed - ie, to clear a cache. I ended up writing a replacement for formlib's applyChanges so that it not only returns a true/false value if changes where made, but also a sequence of Modified descriptions for each changed field. Then when these are included with the modified event, I can do further filtering within my code to see what exactly changed.

Zope3-users mailing list

Reply via email to