Commit 06361b12 authored by Toby Dickenson's avatar Toby Dickenson

merge toby-getserial-branch. Fix for new getSerial behaviour for uncreated objects.

parent 8cba15b4
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
# may have a back pointer to a version record or to a non-version # may have a back pointer to a version record or to a non-version
# record. # record.
# #
__version__='$Revision: 1.133 $'[11:-2] __version__='$Revision: 1.134 $'[11:-2]
import base64 import base64
from cPickle import Pickler, Unpickler, loads from cPickle import Pickler, Unpickler, loads
...@@ -1101,9 +1101,17 @@ class FileStorage(BaseStorage.BaseStorage, ...@@ -1101,9 +1101,17 @@ class FileStorage(BaseStorage.BaseStorage,
def _getSerial(self, oid, pos): def _getSerial(self, oid, pos):
self._file.seek(pos) self._file.seek(pos)
h = self._file.read(16) h = self._file.read(DATA_HDR_LEN)
assert oid == h[:8] oid2, serial, sprev, stloc, vlen, splen = unpack(DATA_HDR, h)
return h[8:] 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): def _transactionalUndoRecord(self, oid, pos, serial, pre, version):
"""Get the indo information for a data record """Get the indo information for a data record
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment