[Zodb-checkins] CVS: StandaloneZODB/ZODB - FileStorage.py:1.78

Jeremy Hylton jeremy@zope.com
Thu, 24 Jan 2002 13:11:20 -0500


Update of /cvs-repository/StandaloneZODB/ZODB
In directory cvs.zope.org:/tmp/cvs-serv23696

Modified Files:
	FileStorage.py 
Log Message:
Don't attempt to load back-pointer if it's 0.

This will allow an iterator to handle aborted versions and undone
object creations.  XXX Still need a test for the latter.


=== StandaloneZODB/ZODB/FileStorage.py 1.77 => 1.78 ===
 
             self._pos=pos+dlen
-            if plen: p=read(plen)
+            if plen:
+                p = read(plen)
             else:
-                p=read(8)
-                p=_loadBack(file, oid, p)[0]
+                p = read(8)
+                if p == z64:
+                    # If the backpointer is 0 (encoded as z64), then
+                    # this transaction undoes the object creation.  It
+                    # either aborts the version that created the
+                    # object or undid the transaction that created it.
+                    # Return None instead of a pickle to indicate
+                    # this.
+                    p = None
+                else:
+                    p = _loadBack(file, oid, p)[0]
                 
             r=Record(oid, serial, version, p)