[Erp5-report] r18319 - /erp5/trunk/products/ERP5Type/patches/DateTimePatch.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Dec 13 22:18:38 CET 2007
Author: kazuhiko
Date: Thu Dec 13 22:18:36 2007
New Revision: 18319
URL: http://svn.erp5.org?rev=18319&view=rev
Log:
improve pickle size of DateTime.
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=18319&r1=18318&r2=18319&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/DateTimePatch.py (original)
+++ erp5/trunk/products/ERP5Type/patches/DateTimePatch.py Thu Dec 13 22:18:36 2007
@@ -31,20 +31,18 @@
STATE_KEY = 'str'
def DateTime__setstate__(self, state):
- if len(state) != 1 or STATE_KEY not in state:
+ if isinstance(state, tuple):
+ self._parse_args(*state)
+ elif len(state) != 1 or STATE_KEY not in state:
+ # For original pickle representation
self.__dict__.update(state)
else:
- # For backward compatibility
+ # For r15569 implementation
self._parse_args(state[STATE_KEY])
DateTimeKlass.__setstate__ = DateTime__setstate__
-
-# This below is disabled, because this loses information at
-# millisecond level, and it breaks the simulation due to
-# divergency tests. I will not disable the above for backward
-# compatibility. -yo
-#
-# def DateTime__getstate__(self):
-# return {STATE_KEY: str(self)}
-#
-# DateTimeKlass.__getstate__ = DateTime__getstate__
+
+def DateTime__getstate__(self):
+ return (self._t, self._tz)
+
+DateTimeKlass.__getstate__ = DateTime__getstate__
More information about the Erp5-report
mailing list