[Zodb-checkins] CVS: Zope3/src/zodb - conflict.py:1.10
Jeremy Hylton
jeremy@zope.com
Fri, 14 Mar 2003 12:19:23 -0500
Update of /cvs-repository/Zope3/src/zodb
In directory cvs.zope.org:/tmp/cvs-serv30965
Modified Files:
conflict.py
Log Message:
Perform conflict resolution in separate object rather than in mixin class.
=== Zope3/src/zodb/conflict.py 1.9 => 1.10 ===
--- Zope3/src/zodb/conflict.py:1.9 Thu Mar 13 16:32:27 2003
+++ Zope3/src/zodb/conflict.py Fri Mar 14 12:18:52 2003
@@ -140,11 +140,13 @@
# a builtin method
return getattr(method, "__self__")
-class ConflictResolvingStorage:
- "Mix-in class that provides conflict resolution handling for storages"
+class ConflictResolver:
- def resolveConflict(self, oid, committedSerial, oldSerial, newpickle,
- committedData=None):
+ def __init__(self, storage):
+ self._storage = storage
+
+ def resolve(self, oid, committedSerial, oldSerial, newpickle,
+ committedData=None):
"""Attempt to resolve conflict for object oid.
Raises ConflictError if the conflict can no be resolved. If
@@ -166,14 +168,14 @@
return None
newstate = reader.getState(newpickle)
- p = self.loadSerial(oid, oldSerial)
+ p = self._storage.loadSerial(oid, oldSerial)
try:
old = reader.getState(p)
except (EOFError, PicklingError), err:
logging.warn("CR: Error loading object: %s", err)
return None
if committedData is None:
- committedData = self.loadSerial(oid, committedSerial)
+ committedData = self._storage.loadSerial(oid, committedSerial)
try:
committed = reader.getState(committedData)
except (EOFError, PicklingError), err: