[Zope3-dev] Re: ObjectHub notes: removing objects

Steve Alexander steve@cat-box.net
Wed, 30 Oct 2002 18:48:36 +0000


> Do you mean that the ObjectHub may relay all events as-is? What would be
> the point of subscribing to those events through the ObjectHub instead
> of directly from the EventService?


The ObjectHub also sends additional events.
It acts like an Event Channel that injects a few extra events as needed.


> That makes the framework look a bit ad-hoc and not very orthogonal to
> me. I don't see what's gained by not being general here.

We're working to the principle that subscribers to HubEvents are 
interested in receiving those events from the time an object is 
registered with the ObjectHub until the time it is unregistered with the 
ObjectHub.

An object can be removed during that time.
An object cannot be added during that time, because adding must occur 
before registration. You cannot register an object that does not exist.


This is unlike how ZPatterns / TransactionAgents works, where we process 
  events at a transaction boundary. At a transaction boundary, we can 
see what has happened to an object during the course of that 
transaction. So, if an object was added and then registered during the 
transaction, we can use the event like that.

In Zope 3, we have separate ObjectAdded events. If you want to register 
an object when it has been added, you can write some event subscriber 
that subscribes to ObjectAdded events, and registers a newly-added 
object with the ObjectHub.

--
Steve Alexander