[z3-five] Zope 3 events for Zope 2

Martijn Faassen faassen at infrae.com
Fri Aug 27 17:39:39 MEST 2004


Hi there,

I've just checked in a feature that enables Zope 3 event sending for 
Zope 2. It can be used as follows:

<!-- make instances send events using Zope 3 mechanism -->
<five:sendEvents class="foo.SomeClass" />

<!-- subscribe to any moved events; function gets called for them -->
<subscriber
     factory="some.function"
     for="zope.app.container.interfaces.IObjectMovedEvent" />

then your function will receive event objects each time an object gets 
moved. A number of events are supported:

zope.app.event.interfaces.IObjectEvent

Sent when any event occurs.

zope.app.container.interfaces.IObjectMovedEvent(IObjectEvent)

sent when an object is moved from one place another, including adding or 
removing an object (modeled as move to or from 'None' container)

zope.app.container.interfaces.IObjectAddedEvent(IObjectMovedEvent)

sent when an object is added to a container.

zope.app.container.interfaces.IObjectRemovedEvent(IObjectMovedEvent)

sent when an object is removed from a container.

zope.app.event.interfaces.IObjectCopiedEvent(IObjectEvent)

sent when an object is copied.

All this works by plugging into the 
manage_afterAdd/beforeDelete/afterClone methods on objects.

There are a number of edge cases that still need to have more thorough 
tests written for it, and people need to check whether the same events 
are sent as in Zope 3 at the same time.

Regards,

Martijn


More information about the z3-five mailing list