Commit 23387167 authored by Jeremy Hylton's avatar Jeremy Hylton

Replace blanket try-except for all exceptions with try-except for

exactly one exception, ConflictError

Remove klass._p_resolveConflict line, because it's only apparent
purpose was to raise an AttributeError that was caught by the blanket
try-except.  Instead, let the later code, which actually uses
_p_resolveConflict() catch the AttributeError and return 0.
parent f66260e5
...@@ -86,6 +86,8 @@ from cStringIO import StringIO ...@@ -86,6 +86,8 @@ from cStringIO import StringIO
from cPickle import Unpickler, Pickler from cPickle import Unpickler, Pickler
import sys import sys
from ZODB.POSException import ConflictError
#import traceback #import traceback
bad_classes={} bad_classes={}
...@@ -157,7 +159,6 @@ def tryToResolveConflict(self, oid, committedSerial, oldSerial, newpickle, ...@@ -157,7 +159,6 @@ def tryToResolveConflict(self, oid, committedSerial, oldSerial, newpickle,
newstate=unpickler.load() newstate=unpickler.load()
klass=_classFactory(class_tuple[0], class_tuple[1]) klass=_classFactory(class_tuple[0], class_tuple[1])
klass._p_resolveConflict
inst=klass.__basicnew__() inst=klass.__basicnew__()
try: try:
...@@ -180,21 +181,7 @@ def tryToResolveConflict(self, oid, committedSerial, oldSerial, newpickle, ...@@ -180,21 +181,7 @@ def tryToResolveConflict(self, oid, committedSerial, oldSerial, newpickle,
pickler.dump(resolved) pickler.dump(resolved)
#sys.stderr.write(' r%s ' % class_tuple[1]); sys.stderr.flush() #sys.stderr.write(' r%s ' % class_tuple[1]); sys.stderr.flush()
return file.getvalue(1) return file.getvalue(1)
except Exception, v: except ConflictError:
#print '='*70
#print v, v.args
#print '='*70
#print old
#print '='*70
#print committed
#print '='*70
#print newstate
#print '='*70
#traceback.print_exc()
#sys.stderr.write(' c%s ' % class_tuple[1]); sys.stderr.flush()
return 0 return 0
class ConflictResolvingStorage: class ConflictResolvingStorage:
......
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