Commit e7d2b75a authored by Jim Fulton's avatar Jim Fulton

Add a helper function replacement for IStorage.load

Because the error semantics of load and loadBefore differ enough that
changing calls isn't trivial.  Plus the helper serves as a handy
transitional load implementation.
parent 44d71a17
...@@ -28,7 +28,6 @@ from ZODB._compat import Unpickler ...@@ -28,7 +28,6 @@ from ZODB._compat import Unpickler
from ZODB._compat import BytesIO from ZODB._compat import BytesIO
from ZODB._compat import ascii_bytes from ZODB._compat import ascii_bytes
__all__ = ['z64', __all__ = ['z64',
'p64', 'p64',
'u64', 'u64',
...@@ -375,3 +374,14 @@ if os.environ.get('DEBUG_LOCKING'): ...@@ -375,3 +374,14 @@ if os.environ.get('DEBUG_LOCKING'):
else: else:
from threading import Condition, Lock, RLock from threading import Condition, Lock, RLock
import ZODB.POSException
def load_current(storage, oid, version=''):
assert not version
r = storage.loadBefore(oid, maxtid)
if r is None:
raise ZODB.POSException.POSKeyError(oid)
assert r[2] is None
return r[:2]
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