[Zodb-checkins] CVS: Zope/lib/python/ZODB - FileStorage.py:1.134

Toby Dickenson tdickenson at geminidataloggers.com
Fri May 30 14:32:08 EDT 2003


Update of /cvs-repository/Zope/lib/python/ZODB
In directory cvs.zope.org:/tmp/cvs-serv7507

Modified Files:
	FileStorage.py 
Log Message:
merge toby-getserial-branch. Fix for new getSerial behaviour for uncreated objects.

=== Zope/lib/python/ZODB/FileStorage.py 1.133 => 1.134 ===
--- Zope/lib/python/ZODB/FileStorage.py:1.133	Thu May 22 14:33:32 2003
+++ Zope/lib/python/ZODB/FileStorage.py	Fri May 30 13:32:07 2003
@@ -1101,9 +1101,17 @@
 
     def _getSerial(self, oid, pos):
         self._file.seek(pos)
-        h = self._file.read(16)
-        assert oid == h[:8]
-        return h[8:]
+        h = self._file.read(DATA_HDR_LEN)
+        oid2, serial, sprev, stloc, vlen, splen = unpack(DATA_HDR, h)
+        assert oid == oid2
+        if splen==z64:
+            # a back pointer
+            bp = self._file.read(8)
+            if bp == z64:
+                # If the backpointer is 0 (encoded as z64), then
+                # this transaction undoes the object creation.
+                raise KeyError(oid)
+        return serial
 
     def _transactionalUndoRecord(self, oid, pos, serial, pre, version):
         """Get the indo information for a data record




More information about the Zodb-checkins mailing list