[ZODB-Dev] rasing a ReadConflictError
Michael Dunstan
michael at looma.co.nz
Tue Aug 31 14:45:40 EDT 2004
I'm working on a fix for Transience (with the help of Chris). There is
a condition in the code in which it makes sense to raise a
ReadConflictError from Transience itself. However it would seem that
there is some light magic required to ensure that this will survive
swallowing of the exception. How about putting the magic into the
__init__ for ReadConflictError?
Here is a patch to try and illustrate what I'm going on about (oh yeah
- this is Zope-2_7-branch):
Index: Connection.py
===================================================================
RCS file: /cvs-repository/Packages/ZODB/Attic/Connection.py,v
retrieving revision 1.98.4.7
diff -u -r1.98.4.7 Connection.py
--- Connection.py 27 Aug 2004 19:03:42 -0000 1.98.4.7
+++ Connection.py 31 Aug 2004 18:29:54 -0000
@@ -614,8 +614,6 @@
# Defer _p_independent() call until state is
loaded.
return 1
else:
- self.getTransaction().register(obj)
- self._conflicts[obj._p_oid] = 1
raise ReadConflictError(object=obj)
else:
return 0
Index: POSException.py
===================================================================
RCS file: /cvs-repository/Packages/ZODB/Attic/POSException.py,v
retrieving revision 1.20.4.3
diff -u -r1.20.4.3 POSException.py
--- POSException.py 27 Aug 2004 19:03:42 -0000 1.20.4.3
+++ POSException.py 31 Aug 2004 18:29:54 -0000
@@ -116,6 +116,8 @@
ConflictError.__init__(self, message="database read conflict
error",
object=object)
self.jar = object._p_jar
+ self.jar.getTransaction().register(object)
+ self.jar._conflicts[object._p_oid] = 1
def ignore(self):
self.jar._ignore_conflict(self.oid)
More information about the ZODB-Dev
mailing list