Commit 78860659 authored by Jim Fulton's avatar Jim Fulton

Various small fixes suggested in review.

parent 0a2670a2
......@@ -794,7 +794,7 @@ class Connection(ExportImport, object):
raise
if s:
if type(s[0]) is bytes:
if type(next(iter(s))) is bytes:
for oid in s:
self._handle_serial(oid)
return
......
......@@ -1012,8 +1012,8 @@ class TransactionalUndo(object):
def tpc_vote(self, transaction):
result = self._storage.tpc_vote(transaction)
if result:
if isinstance(result[0], bytes):
self._oids.update(set(result))
if isinstance(next(iter(result)), bytes):
self._oids.update(result)
else:
for oid, _ in result:
self._oids.add(oid)
......
......@@ -11,7 +11,7 @@ class MultiCommitAdapter:
self._storage = storage
ifaces = zope.interface.providedBy(storage)
zope.interface.alsoProvides(self, ifaces)
self._resolved = set()
self._resolved = set() # {OID}, here to make linters happy
def __getattr__(self, name):
v = getattr(self._storage, name)
......@@ -39,7 +39,7 @@ class MultiCommitAdapter:
def undo(self, transaction_id, transaction):
r = self._storage.undo(transaction_id, transaction)
if r:
self._resolved.update(set(r[1]))
self._resolved.update(r[1])
def tpc_vote(self, *args):
s = self._storage.tpc_vote(*args)
......@@ -47,7 +47,7 @@ class MultiCommitAdapter:
if serial == ResolvedSerial:
self._resolved.add(oid)
return list(self._resolved)
return self._resolved
def tpc_finish(self, transaction, f=lambda tid: None):
......
......@@ -113,7 +113,7 @@ class TransactionalUndoStorage:
oids.extend(undo_result[1])
v = self._storage.tpc_vote(t)
if v:
if isinstance(v[0], bytes):
if isinstance(next(iter(v)), bytes):
oids.extend(v)
else:
oids.extend(oid for (oid, _) in v)
......
......@@ -411,11 +411,6 @@ Similarly, the new object wasn't added to the storage:
...
POSKeyError: 0x...
>>> blob_storage.loadBlob(blob._p_oid, s2)
Traceback (most recent call last):
...
POSKeyError: 'No blob file at <BLOB STORAGE PATH>'
.. clean up
>>> tm1.abort()
......
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