Commit 56dd41ff authored by Tim Peters's avatar Tim Peters

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.
parent 61a84033
......@@ -17,6 +17,7 @@ $Id$
import os, sys
from time import time
import transaction
import Products
from ExtensionClass import Base
from Globals import PersistentMapping
......@@ -321,7 +322,7 @@ def autoRefresh(jar):
Connection.resetCaches()
get_transaction().commit()
jar._resetCache()
get_transaction().begin()
transaction.begin()
def setupAutoRefresh(jar):
# Install hook.
......
......@@ -19,6 +19,7 @@ import unittest
import utils
import profiler
import transaction
from AccessControl import getSecurityManager
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
......@@ -85,7 +86,7 @@ class ZopeTestCase(profiler.Profiled, unittest.TestCase):
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,
......
......@@ -15,6 +15,7 @@ import os, sys
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 @@ class TestPortalTestCase(ZopeTestCase.PortalTestCase):
# with an empty fixture.
self._called = []
# Implicitly aborts previous transaction
get_transaction().begin()
transaction.begin()
def beforeSetUp(self):
self._called.append('beforeSetUp')
......
......@@ -15,6 +15,7 @@ import os, sys
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 @@ class TestZopeTestCase(ZopeTestCase.ZopeTestCase):
# with an empty fixture.
self._called = []
# Implicitly aborts previous transaction
get_transaction().begin()
transaction.begin()
def beforeSetUp(self):
self._called.append('beforeSetUp')
......
......@@ -15,6 +15,7 @@ __doc__="""Python Object Publisher -- Publish Python objects on web servers
$Id$"""
import sys, os
import transaction
from Response import Response
from Request import Request
from maybe_lock import allocate_lock
......@@ -298,9 +299,12 @@ def get_module_info(module_name, modules={},
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
......
......@@ -22,6 +22,7 @@ from types import StringType, ListType
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 @@ def zpublisher_exception_hook(published, REQUEST, t, v, traceback):
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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment