[Zope3-dev] Re: Event fixes

Florent Guillaume fg at nuxeo.com
Mon Nov 28 13:48:07 EST 2005


On 28 Nov 2005, at 19:30, Dominik Huber wrote:
> Florent,
> But at least the event notifications within the setitem function is  
> kind of redundant.
> An add-, move- and remove- event is a part of the container  
> framework. Therefore we can assume that the underlying container  
> referenced by the event.object.__parent__ has changed too.
>
> file: zope.app.container.contained.py:
>
> def setitem(container, setitemf, name, object):
>    ...
>    if event:
>        notify(event)
>        notifyContainerModified(container)

If you don't have this container notification, then when you want to  
know when a given container object is modified you have to listen to  
all add, remove and move events, and then introspect their oldParent  
and newParent. Doh.

The object event framework promises you that if there is something  
happening to an object, you get notified of it directly. That's what  
I'm doing here, I'm notifying that the container object was modified,  
because it was.

If you have a problem with that event, then you should have a problem  
with the whole concept of event dispatching to sublocations, which  
are also "redundant" but which we want to make explicit nevertheless,  
for the benefit of subscribers.

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)   Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg at nuxeo.com




More information about the Zope3-dev mailing list