[Zodb-checkins] CVS: StandaloneZODB/ZODB - FileStorage.py:1.75.16.6 POSException.py:1.7.94.6
Jeremy Hylton
jeremy@zope.com
Mon, 17 Dec 2001 15:16:19 -0500
Update of /cvs-repository/StandaloneZODB/ZODB
In directory cvs.zope.org:/tmp/cvs-serv1134
Modified Files:
Tag: StandaloneZODB-1_0-branch
FileStorage.py POSException.py
Log Message:
Better fix for ZEO unittest bug.
FileStorage was raising a ConflictError and passing an oid to the
object kwarg. This can't work because object must be an actual object
with an _p_oid attribute.
Change Barry's fix and deal with the problem in both places: Add an
optional kwarg oid to ConflictError. Caller can use either oid or
object, but not both. In FileStorage, raise the ConflictError with
oid instead of object.
=== StandaloneZODB/ZODB/FileStorage.py 1.75.16.5 => 1.75.16.6 ===
data=self.tryToResolveConflict(oid, oserial, serial, data)
if not data:
- raise POSException.ConflictError(object=oid,
+ raise POSException.ConflictError(oid=oid,
serials=(oserial, serial))
else:
oserial=serial
=== StandaloneZODB/ZODB/POSException.py 1.7.94.5 => 1.7.94.6 ===
be triggered by a serial number mismatch.)
- oid and class_name may be None if the conflicting object wasn't a
- persistent object.
+ The caller should pass either object or oid as a keyword argument,
+ but not both of them. If object is passed, it should be a
+ persistent object with an _p_oid attribute.
"""
- def __init__(self, message=None, object=None, serials=None):
+ def __init__(self, message=None, object=None, oid=None, serials=None):
if message is None:
self.message = "database conflict error"
else:
self.message = message
- if object is None or isinstance(object, StringType):
+ if object is None:
self.oid = None
self.class_name = None
else:
self.oid = object._p_oid
klass = object.__class__
self.class_name = klass.__module__ + "." + klass.__name__
+
+ if oid is not None:
+ assert self.oid is None
+ self.oid = oid
self.serials = serials