[Zope-dev] Re: What's the deal with sublocations?

Philipp von Weitershausen philipp at weitershausen.de
Tue Apr 10 12:34:01 EDT 2007


Stefan H. Holek wrote:
> Most ObjectEvents are dispatched to "sublocations".

Well, the ones that deal with the object hierarchy. This mostly concerns 
IObjectMovedEvents and their sub-event types (added, removed). I don't 
think it makes a lot of sense to dispatch other object events.

> I was wondering 
> whether it is ok for me to expect a certain dispatch order, i.e. 
> top-down (container before sublocation) or bottom-up (sublocation before 
> container)?

No. The dispatch to sublocations is an event handler itself. One should 
not depend on the execution order of event handlers, therefore you 
should not depend on this dispatch happening before or after your own 
event handler(s) for IObjectMovedEvent.

> What I find is that this order depends on things like the exact 
> interface a handler is registered for and, in Zope 2.9 (+3.2), even on 
> the way I run tests (!).
> 
> I can only conclude that there is no guaranteed dispatch order. Now, 
> should there be? Where can I learn about this contract?

Again, the contract is "don't expect an order".


-- 
http://worldcookery.com -- Professional Zope documentation and training


More information about the Zope-Dev mailing list