Commit d9ab77b8 authored by Julien Muchembled's avatar Julien Muchembled

client: drop support for ZODB < 3.10

parent c4b2c78b
...@@ -30,7 +30,7 @@ class Storage(BaseStorage.BaseStorage, ...@@ -30,7 +30,7 @@ class Storage(BaseStorage.BaseStorage,
ConflictResolution.ConflictResolvingStorage): ConflictResolution.ConflictResolvingStorage):
"""Wrapper class for neoclient.""" """Wrapper class for neoclient."""
implements(*filter(None, ( implements(
ZODB.interfaces.IStorage, ZODB.interfaces.IStorage,
# "restore" missing for the moment, but "store" implements this # "restore" missing for the moment, but "store" implements this
# interface. # interface.
...@@ -41,8 +41,8 @@ class Storage(BaseStorage.BaseStorage, ...@@ -41,8 +41,8 @@ class Storage(BaseStorage.BaseStorage,
# ZODB.interfaces.IStorageIteration, # ZODB.interfaces.IStorageIteration,
ZODB.interfaces.IStorageUndoable, ZODB.interfaces.IStorageUndoable,
ZODB.interfaces.IExternalGC, ZODB.interfaces.IExternalGC,
getattr(ZODB.interfaces, 'ReadVerifyingStorage', None), # BBB ZODB 3.9 ZODB.interfaces.ReadVerifyingStorage,
))) )
def __init__(self, master_nodes, name, read_only=False, def __init__(self, master_nodes, name, read_only=False,
compress=None, logfile=None, _app=None, **kw): compress=None, logfile=None, _app=None, **kw):
......
...@@ -100,10 +100,7 @@ if 1: ...@@ -100,10 +100,7 @@ if 1:
# know any legitimate use of DB access outside a transaction. # know any legitimate use of DB access outside a transaction.
def afterCompletion(self, *ignored): def afterCompletion(self, *ignored):
try:
self._readCurrent.clear() self._readCurrent.clear()
except AttributeError: # BBB: ZODB < 3.10
pass
# PATCH: do not call sync() # PATCH: do not call sync()
self._flush_invalidations() self._flush_invalidations()
Connection.afterCompletion = afterCompletion Connection.afterCompletion = afterCompletion
...@@ -641,14 +641,14 @@ class Application(object): ...@@ -641,14 +641,14 @@ class Application(object):
# A later serial has already been resolved, skip. # A later serial has already been resolved, skip.
resolved_serial_set.update(conflict_serial_set) resolved_serial_set.update(conflict_serial_set)
continue continue
# BBB: On ZODB < 3.10, tryToResolveConflict returns None
# instead of raising ConflictError.
try: try:
new_data = tryToResolveConflict(oid, conflict_serial, new_data = tryToResolveConflict(oid, conflict_serial,
serial, data) serial, data)
except ConflictError: except ConflictError:
new_data = None logging.info('Conflict resolution failed for '
if new_data is not None: '%r:%r with %r', dump(oid), dump(serial),
dump(conflict_serial))
else:
logging.info('Conflict resolution succeeded for ' logging.info('Conflict resolution succeeded for '
'%r:%r with %r', dump(oid), dump(serial), '%r:%r with %r', dump(oid), dump(serial),
dump(conflict_serial)) dump(conflict_serial))
...@@ -660,10 +660,6 @@ class Application(object): ...@@ -660,10 +660,6 @@ class Application(object):
self._store(txn_context, oid, conflict_serial, new_data) self._store(txn_context, oid, conflict_serial, new_data)
append(oid) append(oid)
continue continue
else:
logging.info('Conflict resolution failed for '
'%r:%r with %r', dump(oid), dump(serial),
dump(conflict_serial))
raise ConflictError(oid=oid, serials=(conflict_serial, raise ConflictError(oid=oid, serials=(conflict_serial,
serial), data=data) serial), data=data)
return result return result
......
...@@ -62,7 +62,7 @@ def resolving_tryToResolveConflict(oid, conflict_serial, serial, data): ...@@ -62,7 +62,7 @@ def resolving_tryToResolveConflict(oid, conflict_serial, serial, data):
return data return data
def failing_tryToResolveConflict(oid, conflict_serial, serial, data): def failing_tryToResolveConflict(oid, conflict_serial, serial, data):
return None raise ConflictError
class ClientApplicationTests(NeoUnitTestBase): class ClientApplicationTests(NeoUnitTestBase):
......
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