[Zope-Checkins] SVN: Zope/trunk/lib/python/ Merged 40370 from 2.9
branch:
Florent Guillaume
fg at nuxeo.com
Fri Nov 25 13:50:39 EST 2005
Log message for revision 40371:
Merged 40370 from 2.9 branch:
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/trunk/lib/python/OFS/CopySupport.py
U Zope/trunk/lib/python/OFS/ObjectManager.py
U Zope/trunk/lib/python/OFS/OrderSupport.py
U Zope/trunk/lib/python/Products/BTreeFolder2/BTreeFolder2.py
-=-
Modified: Zope/trunk/lib/python/OFS/CopySupport.py
===================================================================
--- Zope/trunk/lib/python/OFS/CopySupport.py 2005-11-25 18:47:48 UTC (rev 40370)
+++ Zope/trunk/lib/python/OFS/CopySupport.py 2005-11-25 18:50:38 UTC (rev 40371)
@@ -37,6 +37,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
@@ -273,6 +275,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
@@ -346,6 +351,7 @@
ob = self._getOb(new_id)
notify(ObjectMovedEvent(ob, self, id, self, new_id))
+ notifyContainerModified(self)
ob._postCopy(self, op=1)
Modified: Zope/trunk/lib/python/OFS/ObjectManager.py
===================================================================
--- Zope/trunk/lib/python/OFS/ObjectManager.py 2005-11-25 18:47:48 UTC (rev 40370)
+++ Zope/trunk/lib/python/OFS/ObjectManager.py 2005-11-25 18:50:38 UTC (rev 40371)
@@ -53,6 +53,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
@@ -312,6 +314,7 @@
if not suppress_events:
notify(ObjectAddedEvent(ob, self, id))
+ notifyContainerModified(self)
OFS.subscribers.compatibilityCall('manage_afterAdd', ob, ob, self)
@@ -360,6 +363,7 @@
if not suppress_events:
notify(ObjectRemovedEvent(ob, self, id))
+ notifyContainerModified(self)
security.declareProtected(access_contents_information, 'objectIds')
def objectIds(self, spec=None):
Modified: Zope/trunk/lib/python/OFS/OrderSupport.py
===================================================================
--- Zope/trunk/lib/python/OFS/OrderSupport.py 2005-11-25 18:47:48 UTC (rev 40370)
+++ Zope/trunk/lib/python/OFS/OrderSupport.py 2005-11-25 18:50:38 UTC (rev 40371)
@@ -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/trunk/lib/python/Products/BTreeFolder2/BTreeFolder2.py
===================================================================
--- Zope/trunk/lib/python/Products/BTreeFolder2/BTreeFolder2.py 2005-11-25 18:47:48 UTC (rev 40370)
+++ Zope/trunk/lib/python/Products/BTreeFolder2/BTreeFolder2.py 2005-11-25 18:50:38 UTC (rev 40371)
@@ -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.
More information about the Zope-Checkins
mailing list