[Zope-Checkins] SVN: Zope/trunk/lib/python/ Rewrite more instances of the deprecated Transaction_object.begin().

Tim Peters tim.one at comcast.net
Tue Sep 28 14:47:04 EDT 2004


Log message for revision 27703:
  Rewrite more instances of the deprecated Transaction_object.begin().
  
  Caution:  Since no deprecation warnings about Transaction.begin()
  were raised by the test suite before this patch, none of this code
  is exercised by the test suite -- or it is, but "something"
  suppresses the deprecation warnings.  So it's hard to claim that
  this patch has been tested; the strongest claim I can make is that
  all the unit tests still pass.
  


Changed:
  U   Zope/trunk/lib/python/App/RefreshFuncs.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/ZopeTestCase.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/testPortalTestCase.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/testZopeTestCase.py
  U   Zope/trunk/lib/python/ZPublisher/Publish.py
  U   Zope/trunk/lib/python/Zope/App/startup.py


-=-
Modified: Zope/trunk/lib/python/App/RefreshFuncs.py
===================================================================
--- Zope/trunk/lib/python/App/RefreshFuncs.py	2004-09-28 18:17:04 UTC (rev 27702)
+++ Zope/trunk/lib/python/App/RefreshFuncs.py	2004-09-28 18:47:03 UTC (rev 27703)
@@ -17,6 +17,7 @@
 
 import os, sys
 from time import time
+import transaction
 import Products
 from ExtensionClass import Base
 from Globals import PersistentMapping
@@ -321,7 +322,7 @@
         Connection.resetCaches()
         get_transaction().commit()
         jar._resetCache()
-        get_transaction().begin()
+        transaction.begin()
 
 def setupAutoRefresh(jar):
     # Install hook.

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/ZopeTestCase.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/ZopeTestCase.py	2004-09-28 18:17:04 UTC (rev 27702)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/ZopeTestCase.py	2004-09-28 18:47:03 UTC (rev 27703)
@@ -19,6 +19,7 @@
 import utils
 import profiler
 
+import transaction
 from AccessControl import getSecurityManager
 from AccessControl.SecurityManagement import newSecurityManager
 from AccessControl.SecurityManagement import noSecurityManager
@@ -85,7 +86,7 @@
            at the start of setUp(). By default begins
            a new transaction.
         '''
-        get_transaction().begin()
+        transaction.begin()
 
     def beforeClose(self):
         '''Called before the ZODB connection is closed,

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/testPortalTestCase.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/testPortalTestCase.py	2004-09-28 18:17:04 UTC (rev 27702)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/testPortalTestCase.py	2004-09-28 18:47:03 UTC (rev 27703)
@@ -15,6 +15,7 @@
 if __name__ == '__main__':
     execfile(os.path.join(sys.path[0], 'framework.py'))
 
+import transaction
 from Testing import ZopeTestCase
 
 from Acquisition import aq_base
@@ -69,7 +70,7 @@
         # with an empty fixture.
         self._called = []
         # Implicitly aborts previous transaction
-        get_transaction().begin()
+        transaction.begin()
 
     def beforeSetUp(self):
         self._called.append('beforeSetUp')

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/testZopeTestCase.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/testZopeTestCase.py	2004-09-28 18:17:04 UTC (rev 27702)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/testZopeTestCase.py	2004-09-28 18:47:03 UTC (rev 27703)
@@ -15,6 +15,7 @@
 if __name__ == '__main__':
     execfile(os.path.join(sys.path[0], 'framework.py'))
 
+import transaction
 from Testing import ZopeTestCase
 
 from Acquisition import aq_base
@@ -44,7 +45,7 @@
         # with an empty fixture.
         self._called = []
         # Implicitly aborts previous transaction
-        get_transaction().begin()
+        transaction.begin()
 
     def beforeSetUp(self):
         self._called.append('beforeSetUp')

Modified: Zope/trunk/lib/python/ZPublisher/Publish.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/Publish.py	2004-09-28 18:17:04 UTC (rev 27702)
+++ Zope/trunk/lib/python/ZPublisher/Publish.py	2004-09-28 18:47:03 UTC (rev 27703)
@@ -15,6 +15,7 @@
 $Id$"""
 
 import sys, os
+import transaction
 from Response import Response
 from Request import Request
 from maybe_lock import allocate_lock
@@ -298,9 +299,12 @@
 
 
 class DefaultTransactionsManager:
-    def begin(self): get_transaction().begin()
-    def commit(self): get_transaction().commit()
-    def abort(self): get_transaction().abort()
+    def begin(self):
+        transaction.begin()
+    def commit(self):
+        get_transaction().commit()
+    def abort(self):
+        get_transaction().abort()
     def recordMetaData(self, object, request):
         # Is this code needed?
         request_get = request.get

Modified: Zope/trunk/lib/python/Zope/App/startup.py
===================================================================
--- Zope/trunk/lib/python/Zope/App/startup.py	2004-09-28 18:17:04 UTC (rev 27702)
+++ Zope/trunk/lib/python/Zope/App/startup.py	2004-09-28 18:47:03 UTC (rev 27703)
@@ -22,6 +22,7 @@
 from zExceptions import Unauthorized
 from zLOG import LOG, WARNING, INFO, BLATHER, log_time
 from ZODB.POSException import ConflictError
+import transaction
 import AccessControl.User
 import App.FindHomes
 import ExtensionClass
@@ -213,8 +214,8 @@
 class TransactionsManager:
     def begin(self,
               # Optimize global var lookups:
-              get_transaction=get_transaction):
-        get_transaction().begin()
+              transaction=transaction):
+        transaction.begin()
 
     def commit(self,
               # Optimize global var lookups:



More information about the Zope-Checkins mailing list