[Zope3-checkins] CVS: Zope3/src/transaction - _transaction.py:1.1.2.31

Jeremy Hylton jeremy at zope.com
Tue Mar 30 14:43:05 EST 2004


Update of /cvs-repository/Zope3/src/transaction
In directory cvs.zope.org:/tmp/cvs-serv13181

Modified Files:
      Tag: jeremy-txn-branch
	_transaction.py 
Log Message:
Make it possible to create a Transaction without a manager.


=== Zope3/src/transaction/_transaction.py 1.1.2.30 => 1.1.2.31 ===
--- Zope3/src/transaction/_transaction.py:1.1.2.30	Tue Mar 30 12:15:04 2004
+++ Zope3/src/transaction/_transaction.py	Tue Mar 30 14:43:00 2004
@@ -141,7 +141,7 @@
 
 class Transaction(object):
 
-    def __init__(self, synchronizers, manager):
+    def __init__(self, synchronizers=None, manager=None):
         self.status = Status.ACTIVE
         # List of resource managers, e.g. MultiObjectResourceAdapters.
         self._resources = []
@@ -239,7 +239,8 @@
             self._resources = []
         else:
             self.status = Status.COMMITTED
-            self._manager.free(self)
+            if self._manager:
+                self._manager.free(self)
             for s in self._synchronizers:
                 s.afterCompletion()
 
@@ -279,7 +280,8 @@
             finally:
                 if not subtransaction:
                     self.status = Status.FAILED
-                    self._manager.free(self)
+                    if self._manager:
+                        self._manager.free(self)
             raise
 
     def _cleanup(self, L):
@@ -367,7 +369,8 @@
                                    rm, exc_info=sys.exc_info())
 
         if not subtransaction:
-            self._manager.free(self)
+            if self._manager:
+                self._manager.free(self)
             for s in self._synchronizers:
                 s.afterCompletion()
 




More information about the Zope3-Checkins mailing list