[Erp5-report] r43938 vincent - /erp5/trunk/products/ERP5Type/patches/DateTimePatch.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Mar 3 14:18:32 CET 2011


Author: vincent
Date: Thu Mar  3 14:18:32 2011
New Revision: 43938

URL: http://svn.erp5.org?rev=43938&view=rev
Log:
Old DateTime had no __setstate__, restore compatibility.

Modified:
    erp5/trunk/products/ERP5Type/patches/DateTimePatch.py

Modified: erp5/trunk/products/ERP5Type/patches/DateTimePatch.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/DateTimePatch.py?rev=43938&r1=43937&r2=43938&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/DateTimePatch.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/patches/DateTimePatch.py [utf8] Thu Mar  3 14:18:32 2011
@@ -34,7 +34,14 @@ SyntaxError, DateError, TimeError, local
 
 STATE_KEY = 'str'
 
-original_DateTime__setstate__ = DateTimeKlass.__setstate__
+try:
+  original_DateTime__setstate__ = DateTimeKlass.__setstate__
+except AttributeError:
+  # BBB: Running on Zope < 2.11
+  def original_DateTime__setstate__(self, state):
+    dikt = self.__dict__
+    dikt.clear()
+    dikt.update(state)
 
 def DateTime__setstate__(self, state):
   self.__dict__.clear()



More information about the Erp5-report mailing list