[Checkins] SVN: ZODB/branches/3.8-2.5/ r4138@dhcp157: jim | 2007-06-24 13:59:04 -0400

Jim Fulton jim at zope.com
Mon Jun 25 09:58:19 EDT 2007


Log message for revision 77038:
   r4138 at dhcp157:  jim | 2007-06-24 13:59:04 -0400
   Added working pickling support to override Python 2.5's broken
   exception pickling.
   
  

Changed:
  _U  ZODB/branches/3.8-2.5/
  U   ZODB/branches/3.8-2.5/src/ZODB/POSException.py

-=-

Property changes on: ZODB/branches/3.8-2.5
___________________________________________________________________
Name: svk:merge
   + 00440d54-f1b3-4d03-ae2a-ae4fd7ee82eb:/3.8-2.5:4138
62d5b8a3-27da-0310-9561-8e5933582275:/ZODB/branches/3.8:76620
62d5b8a3-27da-0310-9561-8e5933582275:/ZODB/trunk:76619

Modified: ZODB/branches/3.8-2.5/src/ZODB/POSException.py
===================================================================
--- ZODB/branches/3.8-2.5/src/ZODB/POSException.py	2007-06-25 13:09:53 UTC (rev 77037)
+++ ZODB/branches/3.8-2.5/src/ZODB/POSException.py	2007-06-25 13:58:18 UTC (rev 77038)
@@ -21,9 +21,23 @@
     s = reason and (": %s" % reason) or ""
     return "Undo error %s%s" % (oid_repr(oid), s)
 
+def _recon(class_, state):
+    err = class_.__new__(class_)
+    err.__setstate__(state)
+    return err
+_recon.__no_side_effects__ = True
+
 class POSError(StandardError):
     """Persistent object system error."""
 
+    def __reduce__(self):
+        # Cope extra data from internal structures
+        state = self.__dict__.copy()
+        state['message'] = self.message
+        state['args'] = self.args
+
+        return (_recon, (self.__class__, state))
+
 class POSKeyError(KeyError, POSError):
     """Key not found in database."""
 



More information about the Checkins mailing list