[Zope-Checkins] CVS: Zope3/lib/python/Zope/ObjectHub - ObjectHub.py:1.1.2.5
Steve Alexander
steve@cat-box.net
Fri, 1 Mar 2002 11:09:12 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/ObjectHub
In directory cvs.zope.org:/tmp/cvs-serv694/lib/python/Zope/ObjectHub
Modified Files:
Tag: Zope-3x-branch
ObjectHub.py
Log Message:
Changed ObjectRemovedEvent to take an object, as well as the location, as a
payload.
Here's a use-case:
> I want to make a subscriber that listens
> to object events to tell me the full name of contacts that get removed.
>
> To do this currently, I need to store the full name of each contact that
> gets created.
>
> If the object were passed with objectremoved events, I could just ask
> the object.
=== Zope3/lib/python/Zope/ObjectHub/ObjectHub.py 1.1.2.4 => 1.1.2.5 ===
elif IObjectRemovedEvent.isImplementedBy(event):
- self._objectRemoved(event.getLocation())
+ self._objectRemoved(event.getLocation(), event.getObject())
# otherwise, ignore the event
@@ -186,7 +186,7 @@
self.__eventchannel.notify(event)
- def _objectRemoved(self, location):
+ def _objectRemoved(self, location, obj):
location_to_ruid = self.__location_to_ruid
ruid_to_location = self.__ruid_to_location
canonical_location = self._canonical(location)
@@ -202,7 +202,7 @@
# send out to plugins IRuidObjectRemovedEvent
event = RuidObjectRemovedEvent(
- None, # no object to give
+ obj,
ruid,
canonical_location)
self.__eventchannel.notify(event)