[Zodb-checkins] CVS: ZODB3/ZODB - Connection.py:1.113

Jeremy Hylton jeremy at zope.com
Tue Jan 6 12:01:06 EST 2004


Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv16270/ZODB

Modified Files:
	Connection.py 
Log Message:
Another fix for non-current objects.

In the branches that call loadBefore() or raise ConflictError, make
sure we always return.  Either case satisfies the original call to
setstate() and we don't want to load the current state.


=== ZODB3/ZODB/Connection.py 1.112 => 1.113 ===
--- ZODB3/ZODB/Connection.py:1.112	Mon Jan  5 22:44:53 2004
+++ ZODB3/ZODB/Connection.py	Tue Jan  6 12:01:00 2004
@@ -477,10 +477,8 @@
         if (obj._p_oid in self._invalidated
             and not myhasattr(obj, "_p_independent")):
             # If the object has _p_independent(), we will handle it below.
-            if not (self._mvcc and self._setstate_noncurrent(obj)):
-                self.getTransaction().register(obj)
-                self._conflicts[obj._p_oid] = 1
-                raise ReadConflictError(object=obj)
+            self._load_before_or_conflict(obj)
+            return
 
         p, serial = self._storage.load(obj._p_oid, self._version)
         self._load_count += 1
@@ -496,13 +494,20 @@
                 # This call will raise a ReadConflictError if something
                 # goes wrong
                 self._handle_independent(obj)
-            elif not (self._mvcc and self._setstate_noncurrent(obj)):
-                self.getTransaction().register(obj)
-                self._conflicts[obj._p_oid] = 1
-                raise ReadConflictError(object=obj)
+            else:
+                self._load_before_or_conflict(obj)
+                return
 
         self._reader.setGhostState(obj, p)
         obj._p_serial = serial
+
+    def _load_before_or_conflict(self, obj):
+        """Load non-current state for obj or raise ReadConflictError."""
+        
+        if not (self._mvcc and self._setstate_noncurrent(obj)):
+            self.getTransaction().register(obj)
+            self._conflicts[obj._p_oid] = 1
+            raise ReadConflictError(object=obj)
 
     def _setstate_noncurrent(self, obj):
         """Set state using non-current data.




More information about the Zodb-checkins mailing list