[Zope3-checkins] CVS: Zope/lib/python/transaction - _transaction.py:1.6

Tim Peters tim.one at comcast.net
Thu Apr 15 21:08:44 EDT 2004


Update of /cvs-repository/Zope/lib/python/transaction
In directory cvs.zope.org:/tmp/cvs-serv10213/lib/python/transaction

Modified Files:
	_transaction.py 
Log Message:
Finally changed Connection to use the new transaction join API.  This
essentially means a connection keep track of which objects from
the connection are modified, instead of transactions keeping track of that.
A good consequence hasn't yet been implemented:  if a connection is
closed with modifications still pending, we can detect that efficiently
now, and complain.


=== Zope/lib/python/transaction/_transaction.py 1.5 => 1.6 ===
--- Zope/lib/python/transaction/_transaction.py:1.5	Wed Apr 14 16:45:38 2004
+++ Zope/lib/python/transaction/_transaction.py	Thu Apr 15 21:08:13 2004
@@ -80,10 +80,10 @@
 tpc_begin() on each resource manager before calling commit() on any of
 them.
 
-    1. tpc_begin()
-    2. commit()
-    3. tpc_vote()
-    4. tpc_finish()
+    1. tpc_begin(txn, subtransaction=False)
+    2. commit(txn)
+    3. tpc_vote(txn)
+    4. tpc_finish(txn)
 
 Subtransaction commit
 ---------------------
@@ -91,11 +91,11 @@
 When a subtransaction commits, the protocol is different.
 
 1. tpc_begin() is passed a second argument, which indicates that a
-   subtransaction is begin committed.
+   subtransaction is being committed.
 2. tpc_vote() is not called.
 
 Once a subtransaction has been committed, the top-level transaction
-commit will start with a commit_sub() called instead of a tpc_begin()
+commit will start with a commit_sub() call instead of a tpc_begin()
 call.
 
 Error handling
@@ -321,7 +321,11 @@
         # Called when an exception occurs during tpc_vote or tpc_finish.
         for rm in L:
             if id(rm) not in self._voted:
-                rm.cleanup(self)
+                try:
+                    rm.abort(self)
+                except Exception:
+                    self.log.error("Error in abort() on manager %s",
+                                   rm, exc_info=sys.exc_info())
         for rm in L:
             if id(rm) in self._sub:
                 try:
@@ -465,15 +469,9 @@
     def tpc_vote(self, txn):
         self.manager.tpc_vote(txn)
 
-    def cleanup(self, txn):
-        self._abort(self.objects[self.ncommitted:], txn)
-
     def abort(self, txn):
-        self._abort(self.objects, txn)
-
-    def _abort(self, objects, txn):
         tb = None
-        for o in objects:
+        for o in self.objects:
             try:
                 self.manager.abort(o, txn)
             except:




More information about the Zope3-Checkins mailing list