[Zope-Checkins] CVS: Packages/ZODB - Transaction.py:1.49.4.5

Tim Peters tim.one at comcast.net
Wed Aug 25 15:18:00 EDT 2004


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

Modified Files:
      Tag: Zope-2_7-branch
	Transaction.py 
Log Message:
Transaction.begin() should imply abort().

But didn't, if the only changes pending were in subtransactions.  Now it
does, + new checkTxnBeginImpliesAbort test to ensure it stays fixed.


=== Packages/ZODB/Transaction.py 1.49.4.4 => 1.49.4.5 ===
--- Packages/ZODB/Transaction.py:1.49.4.4	Wed Jun  9 14:42:08 2004
+++ Packages/ZODB/Transaction.py	Wed Aug 25 15:17:30 2004
@@ -51,14 +51,19 @@
     description = ''
     _connections = None
     _extension = None
-    _sub = None # This is a subtrasaction flag
+
+    # If there's a subtransaction commit, _sub becomes a dict mapping
+    # id(jar) to jar, for each jar among the registered objects such
+    # that jar.commit_sub exists.  So _sub.values() is the set of jars
+    # that know how to participate in subtransactions.
+    _sub = None
 
     # The _non_st_objects variable is either None or a list
     # of jars that do not support subtransactions. This is used to
     # manage non-subtransaction-supporting jars during subtransaction
     # commits and aborts to ensure that they are correctly committed
     # or aborted in the "outside" transaction.
-    _non_st_objects=None
+    _non_st_objects = None
 
     def __init__(self, id=None):
         self._id=id
@@ -167,9 +172,9 @@
     def begin(self, info=None, subtransaction=None):
         """Begin a new transaction.
 
-        This aborts any transaction in progres.
+        This aborts any transaction in progress.
         """
-        if self._objects:
+        if self._objects or self._sub or self._non_st_objects:
             self.abort(subtransaction, 0)
         if info:
             info=split(info,'\t')



More information about the Zope-Checkins mailing list