[Zodb-checkins] CVS: Zope3/lib/python/Transaction - Manager.py:1.2

Jeremy Hylton jeremy@zope.com
Mon, 7 Oct 2002 19:25:44 -0400


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

Modified Files:
	Manager.py 
Log Message:
Log each transaction transition at DEBUG level.



=== Zope3/lib/python/Transaction/Manager.py 1.1 => 1.2 ===
--- Zope3/lib/python/Transaction/Manager.py:1.1	Wed Jul 24 19:02:53 2002
+++ Zope3/lib/python/Transaction/Manager.py	Mon Oct  7 19:25:43 2002
@@ -1,6 +1,8 @@
 from IDataManager import IRollback
 from Transaction import Transaction, Status
 
+import zLOG
+
 # XXX need to change asserts of transaction status into explicit checks
 # that raise some exception
 
@@ -14,11 +16,14 @@
         pass
 
     def new(self):
-        return self.txn_factory(self)
+        txn = self.txn_factory(self)
+        zLOG.LOG("txn", zLOG.DEBUG, "%s: begin" % txn)
+        return txn
 
     def commit(self, txn):
         assert txn._status is Status.ACTIVE
         prepare_ok = True
+        zLOG.LOG("txn", zLOG.DEBUG, "%s: prepare" % txn)
         for r in txn._resources:
             if prepare_ok and not r.prepare(txn):
                 prepare_ok = False
@@ -29,18 +34,21 @@
             self.abort(txn)
 
     def _commit(self, txn):
+        zLOG.LOG("txn", zLOG.DEBUG, "%s: commit" % txn)
         # finish the two-phase commit
         for r in txn._resources:
             r.commit(txn)
         txn._status = Status.COMMITTED
 
     def abort(self, txn):
+        zLOG.LOG("txn", zLOG.DEBUG, "%s: abort" % txn)
         assert txn._status in (Status.ACTIVE, Status.PREPARED)
         for r in txn._resources:
             r.abort(txn)
         txn._status = Status.ABORTED
 
     def savepoint(self, txn):
+        zLOG.LOG("txn", zLOG.DEBUG, "%s: savepoint" % txn)
         return Rollback([r.savepoint(txn) for r in txn._resources])
 
 class Rollback(object):