[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/OFS/ Added
backward compat for suppress_events parameter passing.
Florent Guillaume
fg at nuxeo.com
Tue Nov 29 10:42:16 EST 2005
Log message for revision 40408:
Added backward compat for suppress_events parameter passing.
Changed:
U Zope/branches/2.9/lib/python/OFS/CopySupport.py
U Zope/branches/2.9/lib/python/OFS/OrderSupport.py
-=-
Modified: Zope/branches/2.9/lib/python/OFS/CopySupport.py
===================================================================
--- Zope/branches/2.9/lib/python/OFS/CopySupport.py 2005-11-29 15:25:58 UTC (rev 40407)
+++ Zope/branches/2.9/lib/python/OFS/CopySupport.py 2005-11-29 15:42:12 UTC (rev 40408)
@@ -16,6 +16,7 @@
"""
import re, sys, tempfile
+import warnings
from cgi import escape
from marshal import loads, dumps
from urllib import quote, unquote
@@ -266,11 +267,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))
@@ -337,13 +354,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))
Modified: Zope/branches/2.9/lib/python/OFS/OrderSupport.py
===================================================================
--- Zope/branches/2.9/lib/python/OFS/OrderSupport.py 2005-11-29 15:25:58 UTC (rev 40407)
+++ Zope/branches/2.9/lib/python/OFS/OrderSupport.py 2005-11-29 15:42:12 UTC (rev 40408)
@@ -16,7 +16,7 @@
"""
from types import StringType
-
+import warnings
from AccessControl import ClassSecurityInfo
from AccessControl.Permissions import access_contents_information
from AccessControl.Permissions import manage_properties
@@ -263,7 +263,16 @@
old_position = self.getObjectPosition(id)
result = super(OrderSupport, self).manage_renameObject(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 result
def tpValues(self):
More information about the Zope-Checkins
mailing list