[z3-checkins] r20400 - z3/Five/branch/Five-1.2

efge at codespeak.net efge at codespeak.net
Tue Nov 29 16:59:04 CET 2005


Author: efge
Date: Tue Nov 29 16:59:03 2005
New Revision: 20400

Modified:
   z3/Five/branch/Five-1.2/CHANGES.txt
   z3/Five/branch/Five-1.2/event.py
Log:
Added backward compatibility for old _setObject and _delObject
implementations without suppress_events.



Modified: z3/Five/branch/Five-1.2/CHANGES.txt
==============================================================================
--- z3/Five/branch/Five-1.2/CHANGES.txt	(original)
+++ z3/Five/branch/Five-1.2/CHANGES.txt	Tue Nov 29 16:59:03 2005
@@ -17,6 +17,9 @@
 Bugfixes
 --------
 
+* (b6) Added backward compatibility for old _setObject and _delObject
+  implementations without suppress_events.
+
 * (b3) Made the creation of custom skins work again.  It was broken in
   the port to Zope 3.2.
 

Modified: z3/Five/branch/Five-1.2/event.py
==============================================================================
--- z3/Five/branch/Five-1.2/event.py	(original)
+++ z3/Five/branch/Five-1.2/event.py	Tue Nov 29 16:59:03 2005
@@ -259,13 +259,29 @@
 
     notify(ObjectWillBeMovedEvent(ob, self, id, self, new_id))
 
-    self._delObject(id, suppress_events=True)
+    try:
+        self._delObject(id, suppress_events=True)
+    except TypeError:
+        # BBB: removed in Zope 2.11
+        self._delObject(id)
+        warnings.warn(
+            "%s._delObject without suppress_events is deprecated "
+            "and will be removed in Zope 2.11." %
+            self.__class__.__name__, DeprecationWarning)
     ob = aq_base(ob)
     ob._setId(new_id)
 
     # Note - because a rename always keeps the same context, we
     # can just leave the ownership info unchanged.
-    self._setObject(new_id, ob, set_owner=0, suppress_events=True)
+    try:
+        self._setObject(new_id, ob, set_owner=0, suppress_events=True)
+    except TypeError:
+        # BBB: removed in Zope 2.11
+        self._setObject(new_id, ob, set_owner=0)
+        warnings.warn(
+            "%s._setObject without suppress_events is deprecated "
+            "and will be removed in Zope 2.11." %
+            self.__class__.__name__, DeprecationWarning)
     ob = self._getOb(new_id)
 
     notify(ObjectMovedEvent(ob, self, id, self, new_id))
@@ -388,11 +404,27 @@
             # along to the new location if needed.
             ob.manage_changeOwnershipType(explicit=1)
 
-            orig_container._delObject(orig_id, suppress_events=True)
+            try:
+                orig_container._delObject(orig_id, suppress_events=True)
+            except TypeError:
+                # BBB: removed in Zope 2.11
+                orig_container._delObject(orig_id)
+                warnings.warn(
+                    "%s._delObject without suppress_events is deprecated "
+                    "and will be removed in Zope 2.11." %
+                    orig_container.__class__.__name__, DeprecationWarning)
             ob = aq_base(ob)
             ob._setId(id)
 
-            self._setObject(id, ob, set_owner=0, suppress_events=True)
+            try:
+                self._setObject(id, ob, set_owner=0, suppress_events=True)
+            except TypeError:
+                # BBB: removed in Zope 2.11
+                self._setObject(id, ob, set_owner=0)
+                warnings.warn(
+                    "%s._setObject without suppress_events is deprecated "
+                    "and will be removed in Zope 2.11." %
+                    self.__class__.__name__, DeprecationWarning)
             ob = self._getOb(id)
 
             notify(ObjectMovedEvent(ob, orig_container, orig_id, self, id))
@@ -476,7 +508,15 @@
     """
     old_position = self.getObjectPosition(id)
     res = CopyContainer.manage_renameObject(self, id, new_id, REQUEST)
-    self.moveObjectToPosition(new_id, old_position, suppress_events=True)
+    try:
+        self.moveObjectToPosition(new_id, old_position, suppress_events=True)
+    except TypeError:
+        # BBB: removed in Zope 2.11
+        self.moveObjectToPosition(new_id, old_position)
+        warnings.warn(
+            "%s.moveObjectToPosition without suppress_events is "
+            "deprecated and will be removed in Zope 2.11." %
+            self.__class__.__name__, DeprecationWarning)
     return res
 
 


More information about the z3-checkins mailing list