[Zodb-checkins] CVS: Zope/lib/python/ZODB/tests -
PackableStorage.py:1.15.28.1
Toby Dickenson
tdickenson at geminidataloggers.com
Wed May 14 18:18:39 EDT 2003
Update of /cvs-repository/Zope/lib/python/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv31545/tests
Modified Files:
Tag: toby_directorystorage_tests_branch
PackableStorage.py
Log Message:
commit objects in the right order to avoid creating a dangling reference
=== Zope/lib/python/ZODB/tests/PackableStorage.py 1.15 => 1.15.28.1 ===
--- Zope/lib/python/ZODB/tests/PackableStorage.py:1.15 Thu Dec 5 19:00:53 2002
+++ Zope/lib/python/ZODB/tests/PackableStorage.py Wed May 14 17:18:39 2003
@@ -199,6 +199,9 @@
# Create a persistent object, with some initial state
obj = self._newobj()
oid = obj.getoid()
+ # Store the persistent object first, to avoid causing a dangling
+ # reference when committing the root. This revision isnt otherwise used.
+ revidn1 = self._dostoreNP(oid, data=pickle.dumps(obj))
# Link the root object to the persistent object, in order to keep the
# persistent object alive. Store the root object.
root.obj = obj
@@ -210,7 +213,7 @@
eq(loads(data).value, 0)
# Commit three different revisions of the other object
obj.value = 1
- revid1 = self._dostoreNP(oid, data=pickle.dumps(obj))
+ revid1 = self._dostoreNP(oid, revid=revidn1, data=pickle.dumps(obj))
obj.value = 2
revid2 = self._dostoreNP(oid, revid=revid1, data=pickle.dumps(obj))
obj.value = 3
More information about the Zodb-checkins
mailing list