Log message for revision 40370:
  Merged Five 1.2 branch changeset 20253:
  Send ContainerModifiedEvent when appropriate.
  
  This requires Five 1.3+ >= r20254.
  
  Some BBB has been kept until Zope 3.2 >= r40368 is stiched in.
  
  

Changed:
  U   Zope/branches/2.9/lib/python/OFS/CopySupport.py
  U   Zope/branches/2.9/lib/python/OFS/ObjectManager.py
  U   Zope/branches/2.9/lib/python/OFS/OrderSupport.py
  U   Zope/branches/2.9/lib/python/Products/BTreeFolder2/BTreeFolder2.py

-=-
Modified: Zope/branches/2.9/lib/python/OFS/CopySupport.py
===================================================================
--- Zope/branches/2.9/lib/python/OFS/CopySupport.py     2005-11-25 17:58:38 UTC 
(rev 40369)
+++ Zope/branches/2.9/lib/python/OFS/CopySupport.py     2005-11-25 18:47:48 UTC 
(rev 40370)
@@ -33,6 +33,8 @@
 from zope.event import notify
 from zope.app.event.objectevent import ObjectCopiedEvent
 from zope.app.container.contained import ObjectMovedEvent
+import Products.Five # BBB: until Zope 3.2 >= r40368 is stiched in
+from zope.app.container.contained import notifyContainerModified
 from OFS.event import ObjectWillBeMovedEvent
 from OFS.event import ObjectClonedEvent
 import OFS.subscribers
@@ -272,6 +274,9 @@
                 ob = self._getOb(id)
 
                 notify(ObjectMovedEvent(ob, orig_container, orig_id, self, id))
+                notifyContainerModified(orig_container)
+                if aq_base(orig_container) is not aq_base(self):
+                    notifyContainerModified(self)
 
                 ob._postCopy(self, op=1)
                 # try to make ownership implicit if possible
@@ -342,6 +347,7 @@
         ob = self._getOb(new_id)
 
         notify(ObjectMovedEvent(ob, self, id, self, new_id))
+        notifyContainerModified(self)
 
         ob._postCopy(self, op=1)
 

Modified: Zope/branches/2.9/lib/python/OFS/ObjectManager.py
===================================================================
--- Zope/branches/2.9/lib/python/OFS/ObjectManager.py   2005-11-25 17:58:38 UTC 
(rev 40369)
+++ Zope/branches/2.9/lib/python/OFS/ObjectManager.py   2005-11-25 18:47:48 UTC 
(rev 40370)
@@ -46,6 +46,8 @@
 from zope.event import notify
 from zope.app.container.contained import ObjectAddedEvent
 from zope.app.container.contained import ObjectRemovedEvent
+import Products.Five # BBB: until Zope 3.2 >= r40368 is stiched in
+from zope.app.container.contained import notifyContainerModified
 from OFS.event import ObjectWillBeAddedEvent
 from OFS.event import ObjectWillBeRemovedEvent
 import OFS.subscribers
@@ -313,6 +315,7 @@
 
         if not suppress_events:
             notify(ObjectAddedEvent(ob, self, id))
+            notifyContainerModified(self)
 
         OFS.subscribers.compatibilityCall('manage_afterAdd', ob, ob, self)
 
@@ -361,6 +364,7 @@
 
         if not suppress_events:
             notify(ObjectRemovedEvent(ob, self, id))
+            notifyContainerModified(self)
 
     def objectIds(self, spec=None):
         # Returns a list of subobject ids of the current object.

Modified: Zope/branches/2.9/lib/python/OFS/OrderSupport.py
===================================================================
--- Zope/branches/2.9/lib/python/OFS/OrderSupport.py    2005-11-25 17:58:38 UTC 
(rev 40369)
+++ Zope/branches/2.9/lib/python/OFS/OrderSupport.py    2005-11-25 18:47:48 UTC 
(rev 40370)
@@ -24,6 +24,8 @@
 from DocumentTemplate.sequence import sort
 from Globals import InitializeClass
 from zope.interface import implements
+import Products.Five # BBB: until Zope 3.2 >= r40368 is stiched in
+from zope.app.container.contained import notifyContainerModified
 
 from interfaces import IOrderedContainer as z3IOrderedContainer
 from IOrderSupport import IOrderedContainer as z2IOrderedContainer
@@ -135,7 +137,8 @@
     #
 
     security.declareProtected(manage_properties, 'moveObjectsByDelta')
-    def moveObjectsByDelta(self, ids, delta, subset_ids=None):
+    def moveObjectsByDelta(self, ids, delta, subset_ids=None,
+                           suppress_events=False):
         """ Move specified sub-objects by delta.
         """
         if type(ids) is StringType:
@@ -180,6 +183,9 @@
                                          'not exist.' % subset_ids[pos])
             self._objects = tuple(objects)
 
+        if not suppress_events:
+            notifyContainerModified(self)
+
         return counter
 
     security.declareProtected(manage_properties, 'moveObjectsUp')
@@ -227,11 +233,12 @@
         raise ValueError('The object with the id "%s" does not exist.' % id)
 
     security.declareProtected(manage_properties, 'moveObjectToPosition')
-    def moveObjectToPosition(self, id, position):
+    def moveObjectToPosition(self, id, position, suppress_events=False):
         """ Move specified object to absolute position.
         """
         delta = position - self.getObjectPosition(id)
-        return self.moveObjectsByDelta(id, delta)
+        return self.moveObjectsByDelta(id, delta,
+                                       suppress_events=suppress_events)
 
     security.declareProtected(access_contents_information, 'getDefaultSorting')
     def getDefaultSorting(self):
@@ -257,7 +264,7 @@
         old_position = self.getObjectPosition(id)
         result = super(OrderSupport, self).manage_renameObject(id, new_id,
                                                                REQUEST)
-        self.moveObjectToPosition(new_id, old_position)
+        self.moveObjectToPosition(new_id, old_position, suppress_events=True)
         return result
 
     def tpValues(self):

Modified: Zope/branches/2.9/lib/python/Products/BTreeFolder2/BTreeFolder2.py
===================================================================
--- Zope/branches/2.9/lib/python/Products/BTreeFolder2/BTreeFolder2.py  
2005-11-25 17:58:38 UTC (rev 40369)
+++ Zope/branches/2.9/lib/python/Products/BTreeFolder2/BTreeFolder2.py  
2005-11-25 18:47:48 UTC (rev 40370)
@@ -40,6 +40,7 @@
 from zope.event import notify
 from zope.app.container.contained import ObjectAddedEvent
 from zope.app.container.contained import ObjectRemovedEvent
+from zope.app.container.contained import notifyContainerModified
 from OFS.event import ObjectWillBeAddedEvent
 from OFS.event import ObjectWillBeRemovedEvent
 import OFS.subscribers
@@ -443,6 +444,7 @@
 
         if not suppress_events:
             notify(ObjectAddedEvent(ob, self, id))
+            notifyContainerModified(self)
 
         OFS.subscribers.compatibilityCall('manage_afterAdd', ob, ob, self)
 
@@ -461,6 +463,7 @@
 
         if not suppress_events:
             notify(ObjectRemovedEvent(ob, self, id))
+            notifyContainerModified(self)
 
 
     # Aliases for mapping-like access.

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to