[Zope3-dev] events and problems
Tres Seaver
tseaver@zope.com
08 Jun 2003 09:01:38 -0400
On Sun, 2003-06-08 at 07:23, Marcus J. Ertl wrote:
> 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/
Seeing events multiple times sounds suspiciously like the behavior we
saw in Zope2, where the event listener was triggering conflict errors,
and hence retrying. It seemed at times as though the event was
"re-entrant".
Tres.
--
===============================================================
Tres Seaver tseaver@zope.com
Zope Corporation "Zope Dealers" http://www.zope.com