[Zope3-checkins] CVS: Zope3/lib/python/ZODB - Connection.py:1.80

Jeremy Hylton jeremy@zope.com
Wed, 2 Oct 2002 14:49:30 -0400


Update of /cvs-repository/Zope3/lib/python/ZODB
In directory cvs.zope.org:/tmp/cvs-serv3313

Modified Files:
	Connection.py 
Log Message:
Make abort() work even if prepare() wasn't called.

The transaction manager will call abort() on every resource manager if
any manager fails its prepare().

XXX Not clear if the manager should abort() things it didn't
prepare().


=== Zope3/lib/python/ZODB/Connection.py 1.79 => 1.80 ===
--- Zope3/lib/python/ZODB/Connection.py:1.79	Thu Sep 19 15:11:32 2002
+++ Zope3/lib/python/ZODB/Connection.py	Wed Oct  2 14:49:29 2002
@@ -107,6 +107,9 @@
         # track which objects are involved with a transaction
         self._txns = {}
 
+        self._modified = Set()
+        self._created = Set()
+        
     def getVersion(self):
         return self._version
         
@@ -394,6 +397,8 @@
         return Rollback(self, undo)
 
     def abort(self, txn):
+        # XXX need test to make sure it is safe to call abort()
+        # without calling prepare()
         if self._tmp is not None:
             self.abort_sub()
         self._storage.tpc_abort(txn)
@@ -410,8 +415,8 @@
         self._modified.clear()
 
     def prepare(self, txn):
-        self._modified = Set()
-        self._created = Set()
+        self._modified.clear()
+        self._created.clear()
         if self._tmp is not None:
             # commit_sub() will call tpc_begin() on the real storage
             self.commit_sub(txn)