Commit 71b6239d authored by Jason Madden's avatar Jason Madden

Per @jimfulton, handle_all_serials shouldn't be sniffying in ZODB5, so try that.

parent f5f670c2
...@@ -102,41 +102,28 @@ def zodb_unpickle(data): ...@@ -102,41 +102,28 @@ def zodb_unpickle(data):
return inst return inst
def handle_all_serials(oid, *args): def handle_all_serials(oid, *args):
"""Return dict of oid to serialno from store() and tpc_vote(). """
Return dict of oid to serialno from store() and tpc_vote().
Raises an exception if one of the calls raised an exception.
The storage interface got complicated when ZEO was introduced.
Any individual store() call can return None or a sequence of
2-tuples where the 2-tuple is either oid, serialno or an
exception to be raised by the client.
The original interface just returned the serialno for the
object.
The updated multi-commit API returns nothing from store(), and The updated multi-commit API returns nothing from store(), and
returns a sequence of resolved oids from tpc_vote. returns a sequence of resolved oids from tpc_vote.
This is pointless with IMultiCommitStorage.
""" """
d = {} d = {}
for arg in args: for arg in args:
if isinstance(arg, bytes): if arg: # store() will have passed us None
d[oid] = arg
elif arg:
for t in arg: for t in arg:
if isinstance(t, bytes): assert isinstance(t, bytes)
# This will be the tid returned by tpc_finish. # This will be the tid returned by tpc_finish.
pass
else:
oid, serial = t
if not isinstance(serial, bytes):
raise serial # error from ZEO server
d[oid] = serial
return d return d
def handle_serials(oid, *args): def handle_serials(oid, *args):
"""Return the serialno for oid based on multiple return values. """Return the serialno for oid based on multiple return values.
A helper for function _handle_all_serials(). A helper for function _handle_all_serials().
This is pointless with IMultiCommitStorage.
""" """
return handle_all_serials(oid, *args).get(oid) return handle_all_serials(oid, *args).get(oid)
...@@ -194,10 +181,7 @@ class StorageTestBase(ZODB.tests.util.TestCase): ...@@ -194,10 +181,7 @@ class StorageTestBase(ZODB.tests.util.TestCase):
r1 = self._storage.store(oid, revid, data, '', t) r1 = self._storage.store(oid, revid, data, '', t)
# Finish the transaction # Finish the transaction
r2 = self._storage.tpc_vote(t) r2 = self._storage.tpc_vote(t)
revid = handle_serials(oid, r1, r2) revid = self._storage.tpc_finish(t)
serial = self._storage.tpc_finish(t)
if serial is not None and revid is None:
revid = serial
except: except:
self._storage.tpc_abort(t) self._storage.tpc_abort(t)
raise raise
......
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