[Zope-CVS] CVS: Products/Event - EventService.py:1.2 IEventService.py:1.2
Sun, 30 Jun 2002 02:35:05 -0400
Update of /cvs-repository/Products/Event
In directory cvs.zope.org:/tmp/cvs-serv22481
When "notify" was called on a subscriber, the subscriber had no
context. Now, the context is the event service (by default), or
a context specified via the context argument to publishEvent.
=== Products/Event/EventService.py 220.127.116.11 => 1.2 ===
- def publishEvent(self, event):
+ def publishEvent(self, event, context=None):
+ # we need a context for the subscriber. If one
+ # is not passed in, we nominate ourselves as the context.
+ if context is None:
+ context = self
subscriptions_collection = self._registry.getAllForObject(event)
for subscriptions in subscriptions_collection:
@@ -63,6 +67,7 @@
if filter is not None:
if not filter(event):
+ subscriber = subscriber.__of__(context)
=== Products/Event/IEventService.py 18.104.22.168 => 1.2 ===
- def publishEvent(event):
+ def publishEvent(event, context=None):
Notify all subscribers of the channel of event.
Events will often be propagated to higher level IEventServices;
This is a policy decision for the IEventService.
+ If context is passed in, it is used for a subscriber's
+ context when the subscriber is notified. If context
+ is not passed in, the subscriber's context will be
+ the event service object itself during notification.