[Zope3-Users] Events

Giovannetti, Mark giovanne at nrcan.gc.ca
Thu Feb 22 12:35:42 EST 2007


Hello David,

> 
> Does anyone know the process by which objects are notified by  
> events?  I created a custom container that stores objects in MySQL.   
> However, I noticed that when I add a container that an  
> ObjectAddedEvent is then propogated to every single object in my  
> container, generating nearly 2000 queries.  From my reading of the  
> core Zope code, it seems that when an event is triggered it is sent  
> to every single object in every container.  This seems rather  
> inefficient if you have either a large container or large objects in  
> your container.  Am I understanding this correctly?   None of my  
> objects subscribe to events (at least not yet).
> 

I was reading about this stuff (source code) last night.  
Perhaps this might help.  The file location is, of course,
system dependent.

From:

/usr/local/www/Zope3/lib/python/zope/app/container/interfaces.py

"class IWriteContainer(Interface):
    """An interface for the write aspects of a container."""

    def __setitem__(name, object):
        """Add the given `object` to the container under the given name.

[snip]...

        If the object's `__parent__` and `__name__` were already set to
        the container and the name, then no events are generated and
        no hooks.  This allows advanced clients to take over event
        generation.

        """ 


Mark


More information about the Zope3-users mailing list