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

Toby Dickenson tdickenson at geminidataloggers.com
Fri May 30 12:56:30 EDT 2003


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

Modified Files:
      Tag: toby-getserial-branch
	FileStorage.py 
Log Message:
fix for updated getSerial behaviour

=== Zope/lib/python/ZODB/FileStorage.py 1.133 => 1.133.2.1 ===
--- Zope/lib/python/ZODB/FileStorage.py:1.133	Thu May 22 14:33:32 2003
+++ Zope/lib/python/ZODB/FileStorage.py	Fri May 30 11:56:29 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