[Zope-CVS] CVS: Products/AdaptableStorage/zodb - RemainingState.py:1.6

Shane Hathaway shane@zope.com
Fri, 17 Jan 2003 22:33:52 -0500


Update of /cvs-repository/Products/AdaptableStorage/zodb
In directory cvs.zope.org:/tmp/cvs-serv4964/zodb

Modified Files:
	RemainingState.py 
Log Message:
Made the remainder pickler properly restore cyclic references to
the persistent object.  Until now, it accidentally made internal
copies of the object.


=== Products/AdaptableStorage/zodb/RemainingState.py 1.5 => 1.6 ===
--- Products/AdaptableStorage/zodb/RemainingState.py:1.5	Fri Jan 10 14:56:21 2003
+++ Products/AdaptableStorage/zodb/RemainingState.py	Fri Jan 17 22:33:50 2003
@@ -47,6 +47,11 @@
     def serialize(self, object, event):
         assert IFullSerializationEvent.isImplementedBy(event)
         assert isinstance(object, Persistent)
+
+        # Allow pickling of cyclic references to the object.
+        event.notifySerialized('self', object, 0)
+
+        # Ignore previously serialized attributes
         state = object.__dict__.copy()
         for key in state.keys():
             if key.startswith('_v_'):
@@ -117,6 +122,10 @@
     def deserialize(self, object, event, state):
         assert IFullDeserializationEvent.isImplementedBy(event)
         assert isinstance(object, Persistent)
+
+        # Set up to recover cyclic references to the object.
+        event.notifyDeserialized('self', object)
+
         if state:
             infile = StringIO(state)
             u = Unpickler(infile)