RE: [Zope3-dev] Sublocation notifications
Gary Poster wrote: > On May 3, 2005, at 5:39 PM, Garrett Smith wrote: > >> We currently dispatch some object events to sublocations. I think >> there's a problem with the current approach. > > ... > > Why not just have your own app listen for (object, event) and then do > this additional dispatch? That's the usual pattern, and I'm guessing > that we have use cases for the current (object, event) spelling. > > Gary The dispatch is already being done in zope\app\container\contained.py -- it's not something I have any control over. We could tear it out I suppose and require applications to handle it. IIRC, there are a few places in zope/app that rely on this dispatching though. -- Garrett ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re: [Zope3-dev] Sublocation notifications
On May 3, 2005, at 5:39 PM, Garrett Smith wrote: We currently dispatch some object events to sublocations. I think there's a problem with the current approach. ... Why not just have your own app listen for (object, event) and then do this additional dispatch? That's the usual pattern, and I'm guessing that we have use cases for the current (object, event) spelling. Gary ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
[Zope3-dev] Sublocation notifications
We currently dispatch some object events to sublocations. I think there's a problem with the current approach. If I subscribe to IObjectModifiedEvent with something like this: def handle(object, event): ... I'll get notifications where object and event.object are different. This happens for sublocation dispatches. This was very surprising, but it makes sense -- there are cases when you'd want to get notifications like that. But most of my code looks like this: def handle(object, event): # ignore Zope's sublocation dispatches if object != event.object: return ... I propose that we dispatch using both the original object and the sublocation, along with the event. Handlers for these sublocation dispatches would then look like this: def handle(object, sublocation, event): ... -- Garrett ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com