[Zope3-Users] Events

David Johnson djohnson at jsatech.com
Thu Feb 22 05:30:28 EST 2007


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).

The problem seems to start in  
zope.app.container.contained.sublocations, which basically queries  
all objects in a container and sends an event to all of them.
excerpt from zope.app.container.contained.ContainerSublocations:

     def sublocations(self):
         container = self.container
         for key in container:
             yield container[key]


Warm regards,
David




More information about the Zope3-users mailing list