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