Commit b7ea4e6f authored by Jim Fulton's avatar Jim Fulton

Merge pull request #64 from zopefoundation/fix-loadBefore-deleted-data

Fixed: FileStorage loadBefore didn't handle deleted/undone data correctly
parents b1ea6733 5b18a710
......@@ -29,6 +29,8 @@
- DemoStorage: add support for conflict resolution and fix history()
https://github.com/zopefoundation/ZODB/pull/58
- Fixed: FileStorage loadBefore didn't handle deleted/undone data correctly.
4.2.0 (2015-06-02)
==================
......
......@@ -489,11 +489,13 @@ class FileStorage(
if not pos:
return None
if h.back:
if h.plen:
return _file.read(h.plen), h.tid, end_tid
elif h.back:
data, _, _, _ = self._loadBack_impl(oid, h.back, _file=_file)
return data, h.tid, end_tid
else:
return _file.read(h.plen), h.tid, end_tid
raise POSKeyError(oid)
def store(self, oid, oldserial, data, version, transaction):
if self._is_read_only:
......
......@@ -179,6 +179,10 @@ class TransactionalUndoStorage:
info = self._storage.undoInfo()
self._undo(info[2]['id'], [oid])
self.assertRaises(KeyError, self._storage.load, oid, '')
# Loading current data via loadBefore should raise a POSKeyError too:
self.assertRaises(KeyError, self._storage.loadBefore, oid,
b'\x7f\xff\xff\xff\xff\xff\xff\xff')
self._iterate()
def checkUndoCreationBranch2(self):
......
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