[Zodb-checkins] CVS: Packages/ZODB - Transaction.py:1.31

Jeremy Hylton jeremy@zope.com
Mon, 22 Oct 2001 16:08:34 -0400


Update of /cvs-repository/Packages/ZODB
In directory cvs.zope.org:/tmp/cvs-serv14153

Modified Files:
	Transaction.py 
Log Message:
Reformat some methods for readability.

(Minor change to tb handling to avoid unnecessary binding to None for
v and tb.)


=== Packages/ZODB/Transaction.py 1.30 => 1.31 ===
                 """)
 
-        t=v=tb=None
-        subj=self._sub
-        subjars=()
+        t = None
+        subj = self._sub
+        subjars = ()
 
         if not subtransaction:
 
@@ -160,40 +160,43 @@
             # may have been stowed away from previous subtransaction
             # commits.
             if self._non_st_objects is not None:
-                append=self._objects.append
-                for object in self._non_st_objects:
-                    append(object)
+                self._objects.extend(self._non_st_objects)
                 self._non_st_objects = None
 
             if subj is not None:
                 # Abort of top-level transaction after commiting
                 # subtransactions.
-                subjars=subj.values()
-                self._sub=None
+                subjars = subj.values()
+                self._sub = None
 
         try:
             # Abort the objects
             for o in self._objects:
                 try:
-                    j=getattr(o, '_p_jar', o)
-                    if j is not None: j.abort(o, self)
+                    j = getattr(o, '_p_jar', o)
+                    if j is not None:
+                        j.abort(o, self)
                 except:
                     if t is None:
-                        t,v,tb=sys.exc_info()
+                        t, v, tb = sys.exc_info()
 
             # Ugh, we need to abort work done in sub-transactions.
             while subjars:
-                j=subjars.pop()
+                j = subjars.pop()
                 j.abort_sub(self) # This should never fail
         
-            if t is not None: raise t,v,tb
+            if t is not None:
+                raise t, v, tb
 
         finally:
-            tb=None
+            if t is not None:
+                del tb # don't keep traceback in local variable
             del self._objects[:] # Clear registered
             if not subtransaction and freeme:
-                if self._id is not None: free_transaction()
-            else: self._init()
+                if self._id is not None:
+                    free_transaction()
+            else:
+                self._init()
 
     def begin(self, info=None, subtransaction=None):
         '''Begin a new transaction.