[Zope3-checkins] CVS: Zope3/src/zope/app/container - contained.py:1.22

Maru Newby maru at thesprawl.net
Tue Mar 23 11:18:03 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/container
In directory cvs.zope.org:/tmp/cvs-serv7690/src/zope/app/container

Modified Files:
	contained.py 
Log Message:


Removed reference to IRemoveNotifiable and IAddNotifiable from setitem and 
uncontained.  Remove and add events will now be handled by explicit 
event subscribers.


=== Zope3/src/zope/app/container/contained.py 1.21 => 1.22 ===
--- Zope3/src/zope/app/container/contained.py:1.21	Mon Mar 15 15:41:58 2004
+++ Zope3/src/zope/app/container/contained.py	Tue Mar 23 11:18:01 2004
@@ -29,8 +29,6 @@
 from zope.app.event.objectevent import ObjectEvent, modified
 from zope.app.event import publish
 from zope.app.i18n import ZopeMessageIDFactory as _
-from zope.app.container.interfaces import IAddNotifiable, IMoveNotifiable
-from zope.app.container.interfaces import IRemoveNotifiable
 from zope.app.container.interfaces import IContained
 from zope.app.container.interfaces import INameChooser
 from zope.app.container.interfaces import IObjectAddedEvent
@@ -447,13 +445,6 @@
     object, event = containedEvent(object, container, name)
     setitemf(name, object)
     if event:
-        if event.__class__ is ObjectAddedEvent:
-            a = IAddNotifiable(object, None)
-            if a is not None:
-                a.addNotify(event)
-        a = IMoveNotifiable(object, None)
-        if a is not None:
-            a.moveNotify(event)
         publish(container, event)
         modified(container)
 
@@ -471,9 +462,7 @@
     We'll start by creating a container with an item:
 
     >>> class Item(Contained):
-    ...     zope.interface.implements(IRemoveNotifiable)
-    ...     def removeNotify(self, event):
-    ...         self.removed = event
+    ...     pass
 
     >>> item = Item()
     >>> container = {u'foo': item}
@@ -510,11 +499,6 @@
     >>> getEvents(IObjectModifiedEvent)[-1].object is container
     1
 
-    The reoved hook was also called:
-
-    >>> item.removed is event
-    1
-
     Now if we call uncontained again:
 
     >>> uncontained(item, container, u'foo')
@@ -562,12 +546,6 @@
         return
 
     event = ObjectRemovedEvent(object, oldparent, oldname)
-    a = IRemoveNotifiable(object, None)
-    if a is not None:
-        a.removeNotify(event)
-    a = IMoveNotifiable(object, None)
-    if a is not None:
-        a.moveNotify(event)
     publish(container, event)
 
     object.__parent__ = None




More information about the Zope3-Checkins mailing list