[Zope-Checkins] CVS: Zope3/lib/python/Zope/Event - IObjectEvent.py:1.1.2.4 ObjectEvent.py:1.1.2.3
Steve Alexander
steve@cat-box.net
Fri, 1 Mar 2002 11:09:12 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/Event
In directory cvs.zope.org:/tmp/cvs-serv694/lib/python/Zope/Event
Modified Files:
Tag: Zope-3x-branch
IObjectEvent.py ObjectEvent.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/Event/IObjectEvent.py 1.1.2.3 => 1.1.2.4 ===
def getLocation():
"""location of the object before it was removed"""
+
+ def getObject():
+ """the object that was removed"""
class IObjectMovedEvent(IObjectEvent):
"""An object has been moved"""
=== Zope3/lib/python/Zope/Event/ObjectEvent.py 1.1.2.2 => 1.1.2.3 ===
__implements__ = IObjectModifiedEvent
-class ObjectRemovedEvent(ObjectAddedEvent):
+class ObjectRemovedEvent:
"""An object has been removed from a container"""
__implements__ = IObjectRemovedEvent
+
+
+ def __init__(self, location, obj):
+ self.__location = location
+ self.__obj = obj
+
+ def getLocation(self):
+ """returns the location the object was removed from"""
+ return self.__location
+
+ def getObject(self):
+ """returns the object that was removed."""
+ return self.__obj
+
class ObjectMovedEvent(ObjectAddedEvent):
"""An object has been moved"""