Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handle_all_serials for the new and old protocols. #86

Merged
merged 2 commits into from
Jul 12, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions src/ZODB/tests/StorageTestBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,28 @@ def handle_all_serials(oid, *args):

The original interface just returned the serialno for the
object.

The updated multi-commit API returns nothing from store(), and
returns a sequence of resolved oids from tpc_vote.

NOTE: This function is removed entirely in ZODB 5.
"""
d = {}
for arg in args:
if isinstance(arg, bytes):
d[oid] = arg
elif arg is None:
pass
else:
for oid, serial in arg:
if not isinstance(serial, bytes):
raise serial # error from ZEO server
d[oid] = serial
elif arg:
for t in arg:
if isinstance(t, bytes):
# New protocol. The caller will use the tid
# returned from tpc_finish if we return a dict
# missing the oid.
pass
else:
oid, serial = t
if not isinstance(serial, bytes):
raise serial # error from ZEO server
d[oid] = serial
return d

def handle_serials(oid, *args):
Expand Down