[Zope-CVS] CVS: Products/AdaptableStorage/zodb - ASConnection.py:1.12.2.2 RemainingState.py:1.2.2.2 consts.py:1.4.2.1 utils.py:1.1.2.2
Christian Zagrodnick
cz@gocept.com
Tue, 21 Jan 2003 03:11:27 -0500
Update of /cvs-repository/Products/AdaptableStorage/zodb
In directory cvs.zope.org:/tmp/cvs-serv25960/zodb
Modified Files:
Tag: zagy-patches
ASConnection.py RemainingState.py consts.py utils.py
Log Message:
merging HEAD into zagy-patches branch
=== Products/AdaptableStorage/zodb/ASConnection.py 1.12.2.1 => 1.12.2.2 ===
--- Products/AdaptableStorage/zodb/ASConnection.py:1.12.2.1 Mon Jan 13 14:15:12 2003
+++ Products/AdaptableStorage/zodb/ASConnection.py Tue Jan 21 03:11:24 2003
@@ -377,6 +377,18 @@
raise
+ def register(self, object):
+ """Register an object with the appropriate transaction manager.
+ """
+ assert object._p_jar is self
+ if object._p_oid is not None:
+ get_transaction().register(object)
+ # else someone is trying to trick ZODB into registering an
+ # object with no OID. OFS.Image.File._read_data() does this.
+ # Since ASConnection really needs meaningful OIDs, just ignore
+ # the attempt.
+
+
def __repr__(self):
if self._version:
ver = ' (in version %s)' % `self._version`
=== Products/AdaptableStorage/zodb/RemainingState.py 1.2.2.1 => 1.2.2.2 ===
--- Products/AdaptableStorage/zodb/RemainingState.py:1.2.2.1 Mon Jan 13 14:15:12 2003
+++ Products/AdaptableStorage/zodb/RemainingState.py Tue Jan 21 03:11:24 2003
@@ -43,9 +43,15 @@
# XXX Python 2.1 thinks Persistent is not a class
return 0
+
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_'):
@@ -116,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)
=== Products/AdaptableStorage/zodb/consts.py 1.4 => 1.4.2.1 ===
--- Products/AdaptableStorage/zodb/consts.py:1.4 Mon Dec 9 13:25:29 2002
+++ Products/AdaptableStorage/zodb/consts.py Tue Jan 21 03:11:24 2003
@@ -16,7 +16,9 @@
$Id$
"""
-DEBUG = 0
+import os
+
+DEBUG = not not os.environ.get('ZODB_MAPPER_DEBUG')
SERIAL0 = '\0' * 8
SERIAL1 = '\0' * 7 + '\001'
=== Products/AdaptableStorage/zodb/utils.py 1.1.2.1 => 1.1.2.2 ===
--- Products/AdaptableStorage/zodb/utils.py:1.1.2.1 Mon Jan 13 14:15:12 2003
+++ Products/AdaptableStorage/zodb/utils.py Tue Jan 21 03:11:24 2003
@@ -29,10 +29,6 @@
def persistent_id(ob, former_ghosts=former_ghosts):
if getattr(ob, '_p_changed', 0) is None:
# Load temporarily
- if former_ghosts:
- for g in former_ghosts:
- g._p_changed = None
- del former_ghosts[:]
former_ghosts.append(ob)
ob._p_changed = 0
return None