[Zope3-dev] Event service subscribe pattern

Steve Alexander steve@cat-box.net
Thu, 18 Apr 2002 17:35:11 +0100


Gary Poster wrote:
> 
> 2. (subscribe pattern)
> 
> Given the same arrangement of event services from question 1, when an object 
> calls "subscribe" (the hookable function "subscribe(context, subscriber, 
> event_types=(None,), filter=None)") from within the child placeful event 
> service, what should happen?  should the subscription be registered with the 
> child or passed on to the parent?

If by "hookable function" you mean the "subscribe" in Event/hooks.py, 
then this is only for use by FileSystem services that want to subscribe 
to the filesystem ZCML-configured EventService.

Placeful objects shouldn't be using this hook.

When a placeful persistent object wants to subscribe, it gets the 
nearest appropriate placeful eventservice, and subscribes to it.

In some cases, the nearest placeful eventservice will to relative to the 
object itself. In other cases, it will be relative to some other object 
it is interested in.

However, there should be no "global vs local" choice. Objects subscribe 
and unsubscribe placefully.

--
Steve Alexander