[Zope3-dev] event service.

Chris McDonough chrism@zope.com
Wed, 22 May 2002 09:56:07 -0400


I've backported the Zope 3 event service to Zope 2, and I've got an
architecture question for those who might be willing to ponder it..

The IEvent interface specifies a that Event objects must have a __call__
method, but specifies no other features.

Objects that implement the ISubscribable interface accept three arguments to
their "subscribe" method: subscriber, event_type, and filter.

The Event Service implementation (which implements the ISubscribable
interface)  runs the event through the filter method for each subscriber
subscribed to a received event type.

However, there is no interface-specified metadata on objects which implement
IEvent that would allow the filter method to switch on an attribute or
method call value.  Currently, when the filter method is called with an
object that implements IEvent, it really can't reliably do much with the
object except call it.

I'm wondering if there should be another interface type, perhaps
IFilterableEvent that specifies another method, 'getFilterData', the return
value of which the filter could examine to see if it's interesting to a
particular subscriber.

- C