[Zope3-dev] events and problems

Marcus J. Ertl marcus.ertl@larp-welt.de
08 Jun 2003 13:23:58 +0200


Hi!

I'm just trying to handle events on my objects. I subscribe to some
events in the afterAddHook()::

    def afterAddHook(self, object, container, 
                     copiedFrom=None, movedFrom=None):
        subscribe(self, event_type=IObjectAddedEvent)
        subscribe(self, event_type=IObjectModifiedEvent)
        subscribe(self, event_type=IObjectRemovedEvent)
    afterAddHook = ContextMethod(afterAddHook)
    
So I want to enable my objects to handle the events local without the
need of an global service.

If I add such an object to zope, all things work fine, it receives the
subscribed events and handles them. But one problem: It gets all events
multiple times.

Now I add a second of this objects, and still all things work fine,
except the fact, that both objects get each event multiple times.

Now I stop Zope3 and restart it.

If I now test my objects, only the one first created receives messages,
but the second one doesn't.

But still the first one gets all events multiple times.

I don't know what's wrong about my product. Perhabs some persistance
issues, or some context problems?

You may have a look at the full code under
https://tiran.faho.rwth-aachen.de:7443/svn/lnproducts3/LNForum/branches/sqlIndex/
or for better browsing per viewcvs:
https://tiran.faho.rwth-aachen.de:7443/viewcvs/LNForum/branches/sqlIndex/

Bye and thank you
   Marcus