Commit 6a451b31 authored by Jim Fulton's avatar Jim Fulton

Added an optional argument to allow you to pass the

committed state in. This is needed wheh the "committed" state,
um, hasn't been committed yet, such as when you are undoing
multiple transactions transactionally.
parent 508678c5
...@@ -98,8 +98,8 @@ def _classFactory(location, name, ...@@ -98,8 +98,8 @@ def _classFactory(location, name,
return getattr(__import__(location, _globals, _globals, _silly), return getattr(__import__(location, _globals, _globals, _silly),
name) name)
def state(self, oid, serial, prfactory): def state(self, oid, serial, prfactory, p=''):
p=self.loadSerial(oid, serial) p=p or self.loadSerial(oid, serial)
file=StringIO(p) file=StringIO(p)
unpickler=Unpickler(file) unpickler=Unpickler(file)
unpickler.persistent_load=prfactory unpickler.persistent_load=prfactory
...@@ -142,7 +142,8 @@ def persistent_id(object, ...@@ -142,7 +142,8 @@ def persistent_id(object,
return None return None
return object.data return object.data
def tryToResolveConflict(self, oid, committedSerial, oldSerial, newpickle): def tryToResolveConflict(self, oid, committedSerial, oldSerial, newpickle,
committedData=''):
#class_tuple, old, committed, newstate = ('',''), 0, 0, 0 #class_tuple, old, committed, newstate = ('',''), 0, 0, 0
try: try:
file=StringIO(newpickle) file=StringIO(newpickle)
...@@ -168,7 +169,7 @@ def tryToResolveConflict(self, oid, committedSerial, oldSerial, newpickle): ...@@ -168,7 +169,7 @@ def tryToResolveConflict(self, oid, committedSerial, oldSerial, newpickle):
return 0 return 0
old=state(self, oid, oldSerial, prfactory) old=state(self, oid, oldSerial, prfactory)
committed=state(self, oid, committedSerial, prfactory) committed=state(self, oid, committedSerial, prfactory, committedData)
resolved=resolve(old, committed, newstate) resolved=resolve(old, committed, newstate)
......
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