[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/ Merge r29750, 29753, 29755, 29756, 29757 from the ZopeX3-3.0.0-Zope-2.8

Philipp von Weitershausen philikon at philikon.de
Mon Jul 25 21:26:36 EDT 2005


Log message for revision 37424:
  Merge r29750, 29753, 29755, 29756, 29757 from the ZopeX3-3.0.0-Zope-2.8
  branch.  This should conclude the Zope 2.8 compatability fixes; the
  X3.0 branch is now ready to be integrated into Zope 2.8 releases
  without further modifications.  ZopeX3-3.0.0-Zope-2.8 branch has become
  obsolete.
  
  Log message for revision 29750:
    Stop using the deprecated get_transaction().
  
  Log message for revision 29753:
    Repair some transaction imports.
  
  Log message for revision 29755:
    Needs to import transaction.
  
  Log message for revision 29756:
    Needs to import transaction.
  
  Log message for revision 29757:
    Brrrr.  An evil doctest depended on significant trailing whitespace in the .py file.  
  

Changed:
  U   Zope3/branches/ZopeX3-3.0/doc/FTEST.txt
  U   Zope3/branches/ZopeX3-3.0/ft.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/adapter/tests.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/appsetup/bootstrap.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/appsetup/tests.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/container/browser/ftests/test_contents.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/container/ftests/test_view_permissions.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/container/tests/test_contained.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/dav/ftests/dav.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/dav/ftests/test_mkcol.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/dav/ftests/test_propfind.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/file/file.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/file/ftests/test_image.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/editview.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_booleanradiowidget.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_checkboxwidget.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_datetimewidget.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_editview.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_filewidget.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_floatwidget.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_intwidget.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_textareawidget.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_textwidget.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/generations/browser/managers.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/generations/generations.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/mail/tests/test_delivery.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/publication/tests/test_browserpublication.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/publication/tests/test_zopepublication.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/publication/zopepublication.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/rdb/tests/test_zopeconnection.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/rdb/tests/test_zopedbtransactionmanager.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/site/service.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/site/servicecontainer.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/traversing/ftests/test_vhosting.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/undo/__init__.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/undo/tests/test_zodbundomanager.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/utility/browser/ftests.py

-=-
Modified: Zope3/branches/ZopeX3-3.0/doc/FTEST.txt
===================================================================
--- Zope3/branches/ZopeX3-3.0/doc/FTEST.txt	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/doc/FTEST.txt	2005-07-26 01:26:35 UTC (rev 37424)
@@ -79,8 +79,8 @@
   `self.getRootFolder()` available to an emulated request, make sure
   to commit the transaction.  Here's how you do it::
 
-    from transaction import get_transaction
-    get_transaction().commit()
+    import transaction
+    transaction.commit()
 
 - Functional tests should not change any global registries.  In
   particular, functional unit test cases should not inherit from

Modified: Zope3/branches/ZopeX3-3.0/ft.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/ft.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/ft.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -38,8 +38,8 @@
         #
         # If you add something to the root folder or in general change
         # anything in the ZODB, you might need to perform a
-        #   from zope.transaction import get_transaction
-        #   get_transaction().commit()
+        #   import transaction
+        #   transaction.commit()
         # for those changes to become visible to the publisher.
 
     def tearDown(self):

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/adapter/tests.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/adapter/tests.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/adapter/tests.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -491,7 +491,7 @@
     >>> L2.lookup([IF2], IB1, 'bob')
     'A112'
 
-    >>> get_transaction().commit()
+    >>> transaction.commit()
 
     Now, let's open another transaction:
 
@@ -525,7 +525,7 @@
     >>> L2.lookup([IF2], IB1, 'bob')
     'A11G'
 
-    >>> get_transaction().commit()
+    >>> transaction.commit()
 
     If we look back at the first connection, we should get the same data:
 
@@ -705,7 +705,7 @@
 from zope.app.adapter.adapter import LocalAdapterRegistry, LocalAdapterService
 import zope.interface
 from ZODB.tests.util import DB
-from transaction import get_transaction
+import transaction
 from zope.app import zapi
 from zope.app.registration.interfaces import RegisteredStatus
 

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/appsetup/bootstrap.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/appsetup/bootstrap.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/appsetup/bootstrap.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -19,7 +19,7 @@
 
 $Id$
 """
-from transaction import get_transaction
+import transaction
 from zope.app.publication.zopepublication import ZopePublication
 from zope.interface import implements
 from zope.component.exceptions import ComponentLookupError
@@ -80,7 +80,7 @@
 
         self.doSetup()
 
-        get_transaction().commit()
+        transaction.commit()
         connection.close()
 
     def ensureObject(self, object_name, object_type, object_factory):

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/appsetup/tests.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/appsetup/tests.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/appsetup/tests.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -16,7 +16,7 @@
 $Id$
 """
 import unittest
-from transaction import get_transaction
+import transaction
 from ZODB.tests.util import DB
 from zope.exceptions import NotFoundError
 
@@ -52,7 +52,7 @@
         root = cx.root()
         self.root_folder = rootFolder()
         root[ZopePublication.root_name] = self.root_folder
-        get_transaction().commit()
+        transaction.commit()
         cx.close()
 
     def createRFAndSM(self):
@@ -62,7 +62,7 @@
         root[ZopePublication.root_name] = self.root_folder
         self.service_manager = ServiceManager(self.root_folder)
         self.root_folder.setSiteManager(self.service_manager)
-        get_transaction().commit()
+        transaction.commit()
         cx.close()
 
 
@@ -108,7 +108,7 @@
 
             self.assert_(IErrorReportingService.providedBy(
                 traverse(package, 'ErrorLogging')))
-            get_transaction().commit()
+            transaction.commit()
             cx.close()
 
 class TestBootstrapInstance(TestBootstrapSubscriberBase):

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/container/browser/ftests/test_contents.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/container/browser/ftests/test_contents.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/container/browser/ftests/test_contents.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -19,7 +19,7 @@
 import unittest
 
 from persistent import Persistent
-from transaction import get_transaction
+import transaction
 from zope.app.tests.functional import BrowserTestCase
 from zope.interface import implements
 
@@ -63,7 +63,7 @@
         root = self.getRootFolder()
         root['foo'] = File()
         self.assert_('foo' in root)
-        get_transaction().commit()
+        transaction.commit()
 
         # Check that we don't change mode if there are no items selected
         
@@ -111,7 +111,7 @@
         root = self.getRootFolder()
         root['foo'] = File()
         self.assert_('foo' in root)
-        get_transaction().commit()
+        transaction.commit()
         
         response = self.publish('/@@contents.html',
                                 basic='mgr:mgrpw',
@@ -138,7 +138,7 @@
     def test_inplace_change_title(self):
         root = self.getRootFolder()
         root['foo'] = File()
-        get_transaction().commit()
+        transaction.commit()
         self.assert_('foo' in root)
         dc = IZopeDublinCore(root['foo'])
         self.assert_(dc.title == '')
@@ -175,7 +175,7 @@
         root['foo'] = File()    # item to be copied/deleted
         root['bar'] = File()    # ensures that there's always an item in
                                 # the collection view
-        get_transaction().commit()
+        transaction.commit()
 
         # confirm foo in contents, Copy button visible, Paste not visible
         response = self.publish('/@@contents.html', basic='mgr:mgrpw')
@@ -201,7 +201,7 @@
 
         # delete foo -> nothing valid to paste -> Paste should not be visible
         del root['foo']
-        get_transaction().commit()
+        transaction.commit()
         response = self.publish('/@@contents.html', basic='mgr:mgrpw')
         self.assertEqual(response.getStatus(), 200)
         self.assert_(response.getBody().find(
@@ -214,7 +214,7 @@
         root = self.getRootFolder()
         root['foo'] = File()
         root['bar'] = File()
-        get_transaction().commit()
+        transaction.commit()
 
         # confirm foo/bar in contents, Copy button visible, Paste not visible
         response = self.publish('/@@contents.html', basic='mgr:mgrpw')
@@ -242,7 +242,7 @@
 
         # delete only foo -> bar still available -> Paste should be visible
         del root['foo']
-        get_transaction().commit()
+        transaction.commit()
         response = self.publish('/@@contents.html', basic='mgr:mgrpw')
         self.assertEqual(response.getStatus(), 200)
         self.assert_(response.getBody().find(

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/container/ftests/test_view_permissions.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/container/ftests/test_view_permissions.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/container/ftests/test_view_permissions.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -16,7 +16,7 @@
 $Id: $
 """
 import unittest
-from transaction import get_transaction
+import transaction
 
 from zope.security.interfaces import Unauthorized
 
@@ -39,7 +39,7 @@
         file = File()
         self.getRootFolder()['file'] = file
         IZopeDublinCore(file).title = u'My File'
-        get_transaction().commit()
+        transaction.commit()
 
         response = self.publish('/')
         self.assertEquals(response.getStatus(), 200)
@@ -60,7 +60,7 @@
         # deny zope.View to zope.Anonymous
         prm = IRolePermissionManager(self.getRootFolder())
         prm.denyPermissionToRole('zope.View', 'zope.Anonymous')
-        get_transaction().commit()
+        transaction.commit()
 
         # confirm Unauthorized when viewing root folder
         self.assertRaises(Unauthorized, self.publish, '/')
@@ -80,7 +80,7 @@
         # deny zope.app.dublincore.view to zope.Anonymous
         prm = IRolePermissionManager(self.getRootFolder())
         prm.denyPermissionToRole('zope.app.dublincore.view', 'zope.Anonymous')
-        get_transaction().commit()
+        transaction.commit()
 
         response = self.publish('/')
         self.assertEquals(response.getStatus(), 200)

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/container/tests/test_contained.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/container/tests/test_contained.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/container/tests/test_contained.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -15,7 +15,7 @@
 import gc
 from ZODB.DemoStorage import DemoStorage
 from ZODB.DB import DB
-from transaction import get_transaction
+import transaction
 from persistent import Persistent
 
 import zope.interface
@@ -62,7 +62,7 @@
     >>> db = DB(DemoStorage('test_storage'))
     >>> c = db.open()
     >>> c.root()['p'] = p
-    >>> get_transaction().commit()
+    >>> transaction.commit()
 
     >>> c2 = db.open()
     >>> p2 = c2.root()['p']
@@ -171,7 +171,7 @@
     >>> c1 = db.open()
     >>> c1.root()['parent'] = parent
     >>> c1.root()['other'] = other
-    >>> get_transaction().commit()
+    >>> transaction.commit()
 
     We'll open a second connection and verify that we have the data we
     expect:
@@ -206,7 +206,7 @@
 
     And save the changes:
     
-    >>> get_transaction().commit()
+    >>> transaction.commit()
 
     Now we'll reopen the first connection and verify that we can see
     the changes:
@@ -242,7 +242,7 @@
     >>> for i in range(10):
     ...     conn.root()[i] = MyOb()
 
-    >>> get_transaction().commit()
+    >>> transaction.commit()
 
     Let's get the oid of our proxy:
 

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/dav/ftests/dav.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/dav/ftests/dav.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/dav/ftests/dav.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -16,7 +16,7 @@
 $Id$
 """
 from persistent import Persistent
-from transaction import get_transaction
+import transaction
 from zope.interface import implements
 from zope.app.tests.functional import HTTPTestCase
 
@@ -47,7 +47,7 @@
     def createObject(self, path, obj):
         folder, id = self.createFolders(path)
         folder[id] = obj
-        get_transaction().commit()
+        transaction.commit()
 
     def addPage(self, path, content):
         page = Page()

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/dav/ftests/test_mkcol.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/dav/ftests/test_mkcol.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/dav/ftests/test_mkcol.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -18,19 +18,19 @@
 import unittest
 
 from zope.app.dav.ftests.dav import DAVTestCase
-from transaction import get_transaction
+import transaction
 
 class TestMKCOL(DAVTestCase):
 
     def test_mkcol_not_folderish(self):
         self.addPage('/bar/pt', u'<span />')
-        get_transaction().commit()
+        transaction.commit()
         self.verifyStatus(path='/bar/pt/foo', body='', basic='mgr:mgrpw',
                           expected=404)
 
     def test_mkcol_not_folderish_existing(self):
         self.addPage('/bar/pt', u'<span />')
-        get_transaction().commit()
+        transaction.commit()
         self.verifyStatus(path='/bar/pt', body='', basic='mgr:mgrpw',
                           expected=405)
 
@@ -44,7 +44,7 @@
 
     def test_mkcol_existing(self):
         self.createFolders('/bar/mkcol_test')
-        get_transaction().commit()
+        transaction.commit()
         self.verifyStatus(path='/bar', body='', basic='mgr:mgrpw',
                           expected=405)
 

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/dav/ftests/test_propfind.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/dav/ftests/test_propfind.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/dav/ftests/test_propfind.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -17,7 +17,7 @@
 """
 import unittest
 from datetime import datetime
-from transaction import get_transaction
+import transaction
 from zope.pagetemplate.tests.util import normalize_xml
 
 from zope.app import zapi
@@ -37,7 +37,7 @@
         pt = traverse(self.getRootFolder(), '/pt')
         adapted = IZopeDublinCore(pt)
         adapted.title = u'Test Title'
-        get_transaction().commit()
+        transaction.commit()
         self.verifyPropOK(path='/pt', ns='http://purl.org/dc/1.1',
                           prop='title', expect='Test Title', basic='mgr:mgrpw')
 
@@ -46,7 +46,7 @@
         pt = traverse(self.getRootFolder(), '/pt')
         adapted = IZopeDublinCore(pt)
         adapted.created = datetime.utcnow()
-        get_transaction().commit()
+        transaction.commit()
         expect = str(adapted.created)
         self.verifyPropOK(path='/pt', ns='http://purl.org/dc/1.1',
                           prop='created', expect=expect, basic='mgr:mgrpw')
@@ -56,7 +56,7 @@
         pt = traverse(self.getRootFolder(), '/pt')
         adapted = IZopeDublinCore(pt)
         adapted.subjects = (u'Bla', u'Ble', u'Bli')
-        get_transaction().commit()
+        transaction.commit()
         expect = ', '.join(adapted.subjects)
         self.verifyPropOK(path='/pt', ns='http://purl.org/dc/1.1',
                           prop='subjects', expect=expect, basic='mgr:mgrpw')

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/file/file.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/file/file.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/file/file.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -16,7 +16,7 @@
 $Id$
 """
 from persistent import Persistent
-from transaction import get_transaction
+import transaction
 from zope.interface import implements
 
 from zope.publisher.browser import FileUpload
@@ -163,7 +163,7 @@
 
         # Make sure we have an _p_jar, even if we are a new object, by
         # doing a sub-transaction commit.
-        get_transaction().commit(1)
+        transaction.commit(1)
 
         jar = self._p_jar
 
@@ -195,7 +195,7 @@
             data.next = next
 
             # Now make it get saved in a sub-transaction!
-            get_transaction().commit(1)
+            transaction.commit(1)
 
             # Now make it a ghost to free the memory.  We
             # don't need it anymore!

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/file/ftests/test_image.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/file/ftests/test_image.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/file/ftests/test_image.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -18,7 +18,6 @@
 import unittest
 import cgi
 from cStringIO import StringIO
-from transaction import get_transaction
 from zope.app.tests.functional import BrowserTestCase
 from zope.publisher.browser import FileUpload
 

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/editview.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/editview.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/editview.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -16,7 +16,7 @@
 $Id$
 """
 from datetime import datetime
-from transaction import get_transaction
+import transaction
 
 from zope.schema import getFieldNamesInOrder
 from zope.publisher.interfaces.browser import IBrowserRequest
@@ -104,7 +104,7 @@
             except WidgetsError, errors:
                 self.errors = errors
                 status = _("An error occured.")
-                get_transaction().abort()
+                transaction.abort()
             else:
                 setUpEditWidgets(self, self.schema, source=self.adapted,
                                  ignoreStickyValues=True, 

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_booleanradiowidget.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_booleanradiowidget.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_booleanradiowidget.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -17,7 +17,7 @@
 """
 import unittest
 from persistent import Persistent
-from transaction import get_transaction
+import transaction
 
 from support import *
 
@@ -54,7 +54,7 @@
 
     def test_display_editform(self):
         self.getRootFolder()['foo'] = Foo()
-        get_transaction().commit()
+        transaction.commit()
 
         # display edit view
         response = self.publish('/foo/edit.html')
@@ -77,7 +77,7 @@
 
     def test_submit_editform(self):
         self.getRootFolder()['foo'] = Foo()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit edit view
         response = self.publish('/foo/edit.html', form={
@@ -93,7 +93,7 @@
 
     def test_missing_value(self):
         self.getRootFolder()['foo'] = Foo()
-        get_transaction().commit()
+        transaction.commit()
         
         # temporarily make bar field not required
         IFoo['bar'].required = False
@@ -116,7 +116,7 @@
 
     def test_required_validation(self):
         self.getRootFolder()['foo'] = Foo()
-        get_transaction().commit()
+        transaction.commit()
         
         self.assert_(IFoo['bar'].required)
 
@@ -132,7 +132,7 @@
 
     def test_invalid_allowed_value(self):
         self.getRootFolder()['foo'] = Foo()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit a value for bar isn't allowed
         response = self.publish('/foo/edit.html', form={

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_checkboxwidget.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_checkboxwidget.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_checkboxwidget.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -17,7 +17,7 @@
 """
 import unittest
 from persistent import Persistent
-from transaction import get_transaction
+import transaction
 
 from zope.interface import Interface
 from zope.interface import implements
@@ -59,7 +59,7 @@
 
     def test_display_editform(self):
         self.getRootFolder()['test'] = BoolTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # display edit view
         response = self.publish('/test/edit.html')
@@ -82,7 +82,7 @@
 
     def test_submit_editform(self):
         self.getRootFolder()['test'] = BoolTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit edit view
         response = self.publish('/test/edit.html', form={
@@ -103,7 +103,7 @@
         object.b1 = True
         object.b2 = True
         self.getRootFolder()['test'] = object
-        get_transaction().commit()
+        transaction.commit()
 
         # submit invalud type for text line
         response = self.publish('/test/edit.html', form={
@@ -124,7 +124,7 @@
         # test confirms that one cannot set a Bool field to None.
 
         self.getRootFolder()['test'] = BoolTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # confirm default value of b1 is True
         object = traverse(self.getRootFolder(), 'test')

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_datetimewidget.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_datetimewidget.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_datetimewidget.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -18,7 +18,7 @@
 import unittest
 import re
 from persistent import Persistent
-from transaction import get_transaction
+import transaction
 from datetime import datetime
 from zope.app.datetimeutils import parseDatetimetz, tzinfo
 
@@ -94,7 +94,7 @@
 
     def test_display_editform(self):
         self.getRootFolder()['test'] = DatetimeTest()
-        get_transaction().commit()
+        transaction.commit()
         object = traverse(self.getRootFolder(), 'test')
 
         # display edit view
@@ -109,7 +109,7 @@
 
     def test_submit_editform(self):
         self.getRootFolder()['test'] = DatetimeTest()
-        get_transaction().commit()
+        transaction.commit()
 
         d1 = datetime(2003, 2, 1, tzinfo=tzinfo(0))
         d2 = datetime(2003, 2, 2, tzinfo=tzinfo(0))
@@ -134,7 +134,7 @@
 
     def test_missing_value(self):
         self.getRootFolder()['test'] = DatetimeTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit missing values for d2 and d3
         response = self.publish('/test/edit.html', form={
@@ -153,7 +153,7 @@
 
     def test_required_validation(self):
         self.getRootFolder()['test'] = DatetimeTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit missing values for required field d1
         response = self.publish('/test/edit.html', form={
@@ -171,7 +171,7 @@
 
     def test_invalid_value(self):
         self.getRootFolder()['test'] = DatetimeTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit a value for d3 that isn't allowed
         response = self.publish('/test/edit.html', form={
@@ -183,7 +183,7 @@
 
     def test_min_max_validation(self):
         self.getRootFolder()['test'] = DatetimeTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit value for d1 that is too low
         response = self.publish('/test/edit.html', form={
@@ -204,7 +204,7 @@
 
     def test_omitted_value(self):
         self.getRootFolder()['test'] = DatetimeTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # remember default values
         object = traverse(self.getRootFolder(), 'test')

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_editview.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_editview.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_editview.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -17,7 +17,7 @@
 """
 import unittest
 from persistent import Persistent
-from transaction import get_transaction
+import transaction
 
 from zope.interface import Interface
 from zope.interface import implements
@@ -59,7 +59,7 @@
         self.getRootFolder()['foo'] = Foo()
         self.getRootFolder()['foo'].required_text = u'initial required'
         self.getRootFolder()['foo'].optional_text = u'initial optional'
-        get_transaction().commit()
+        transaction.commit()
 
         # submit form with legal value for optional_text and invalid for 
         # required_text

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_filewidget.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_filewidget.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_filewidget.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -18,7 +18,7 @@
 import unittest
 from StringIO import StringIO
 from persistent import Persistent
-from transaction import get_transaction
+import transaction
 
 from zope.interface import Interface
 from zope.interface import implements
@@ -83,7 +83,7 @@
 
     def test_display_editform(self):
         self.getRootFolder()['test'] = FileTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # display edit view
         response = self.publish('/test/edit.html')
@@ -98,7 +98,7 @@
 
     def test_submit_text(self):
         self.getRootFolder()['test'] = FileTest()
-        get_transaction().commit()
+        transaction.commit()
         object = traverse(self.getRootFolder(), 'test')
         self.assert_(object.f1 is None)
         self.assertEqual(object.f2, 'foo')
@@ -119,7 +119,7 @@
 
     def test_invalid_value(self):
         self.getRootFolder()['test'] = FileTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit an invalid file value
         response = self.publish('/test/edit.html', form={
@@ -135,7 +135,7 @@
     # my patience looking at it. 
     def XXX_test_required_validation(self):
         self.getRootFolder()['test'] = FileTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit missing value for required field f1
         response = self.publish('/test/edit.html', form={
@@ -151,7 +151,7 @@
 
     def test_empty_file(self):
         self.getRootFolder()['test'] = FileTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit an empty text file
         response = self.publish('/test/edit.html', form={

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_floatwidget.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_floatwidget.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_floatwidget.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -17,7 +17,7 @@
 """
 import unittest
 from persistent import Persistent
-from transaction import get_transaction
+import transaction
 
 from support import *
 
@@ -66,7 +66,7 @@
 
     def test_display_editform(self):
         self.getRootFolder()['test'] = FloatTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # display edit view
         response = self.publish('/test/edit.html')
@@ -88,7 +88,7 @@
 
     def test_submit_editform(self):
         self.getRootFolder()['test'] = FloatTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit edit view
         response = self.publish('/test/edit.html', form={
@@ -108,7 +108,7 @@
 
     def test_missing_value(self):
         self.getRootFolder()['test'] = FloatTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit missing values for f2 and f3
         response = self.publish('/test/edit.html', form={
@@ -128,7 +128,7 @@
 
     def test_required_validation(self):
         self.getRootFolder()['test'] = FloatTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit missing values for required field f1
         response = self.publish('/test/edit.html', form={
@@ -146,7 +146,7 @@
 
     def test_invalid_allowed_value(self):
         self.getRootFolder()['test'] = FloatTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit a value for f3 that isn't allowed
         response = self.publish('/test/edit.html', form={
@@ -158,7 +158,7 @@
 
     def test_min_max_validation(self):
         self.getRootFolder()['test'] = FloatTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit value for f1 that is too low
         response = self.publish('/test/edit.html', form={
@@ -179,7 +179,7 @@
 
     def test_omitted_value(self):
         self.getRootFolder()['test'] = FloatTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # confirm default values
         object = traverse(self.getRootFolder(), 'test')
@@ -204,7 +204,7 @@
 
     def test_conversion(self):
         self.getRootFolder()['test'] = FloatTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit value for f1 that cannot be convert to an float
         response = self.publish('/test/edit.html', form={

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_intwidget.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_intwidget.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_intwidget.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -17,7 +17,7 @@
 """
 import unittest
 from persistent import Persistent
-from transaction import get_transaction
+import transaction
 
 from support import *
 
@@ -88,7 +88,7 @@
 
     def test_display_editform(self):
         self.getRootFolder()['test'] = IntTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # display edit view
         response = self.publish('/test/edit.html')
@@ -110,7 +110,7 @@
 
     def test_submit_editform(self):
         self.getRootFolder()['test'] = IntTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit edit view
         response = self.publish('/test/edit.html', form={
@@ -130,7 +130,7 @@
 
     def test_missing_value(self):
         self.getRootFolder()['test'] = IntTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit missing values for i2 and i3
         response = self.publish('/test/edit.html', form={
@@ -154,7 +154,7 @@
         """
 
         self.getRootFolder()['test'] = IntTest2() # note alt. class
-        get_transaction().commit()
+        transaction.commit()
 
         # display edit form
         response = self.publish('/test/edit.html')
@@ -184,7 +184,7 @@
 
     def test_required_validation(self):
         self.getRootFolder()['test'] = IntTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit missing values for required field i1
         response = self.publish('/test/edit.html', form={
@@ -202,7 +202,7 @@
 
     def test_invalid_allowed_value(self):
         self.getRootFolder()['test'] = IntTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit a value for i3 that isn't allowed
         response = self.publish('/test/edit.html', form={
@@ -214,7 +214,7 @@
 
     def test_min_max_validation(self):
         self.getRootFolder()['test'] = IntTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit value for i1 that is too low
         response = self.publish('/test/edit.html', form={
@@ -235,7 +235,7 @@
 
     def test_omitted_value(self):
         self.getRootFolder()['test'] = IntTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # confirm default values
         object = traverse(self.getRootFolder(), 'test')
@@ -260,7 +260,7 @@
 
     def test_conversion(self):
         self.getRootFolder()['test'] = IntTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit value for i1 that cannot be convert to an int
         response = self.publish('/test/edit.html', form={

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_textareawidget.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_textareawidget.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_textareawidget.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -17,7 +17,7 @@
 """
 import unittest
 from persistent import Persistent
-from transaction import get_transaction
+import transaction
 
 from zope.interface import Interface
 from zope.interface import implements
@@ -64,7 +64,7 @@
 
     def test_display_editform(self):
         self.getRootFolder()['test'] = TextTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # display edit view
         response = self.publish('/test/edit.html')
@@ -84,7 +84,7 @@
 
     def test_submit_editform(self):
         self.getRootFolder()['test'] = TextTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit edit view
         response = self.publish('/test/edit.html', form={
@@ -109,7 +109,7 @@
         unicode.
         """
         self.getRootFolder()['test'] = TextTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit invalid type for text
         response = self.publish('/test/edit.html', form={
@@ -124,7 +124,7 @@
 
     def test_missing_value(self):
         self.getRootFolder()['test'] = TextTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit missing values for s2 and s3
         response = self.publish('/test/edit.html', form={
@@ -144,7 +144,7 @@
 
     def test_required_validation(self):
         self.getRootFolder()['test'] = TextTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit missing values for required field s1
         response = self.publish('/test/edit.html', form={
@@ -162,7 +162,7 @@
 
     def test_length_validation(self):
         self.getRootFolder()['test'] = TextTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit value for s1 that is too short
         response = self.publish('/test/edit.html', form={
@@ -183,7 +183,7 @@
 
     def test_omitted_value(self):
         self.getRootFolder()['test'] = TextTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # confirm default values
         object = traverse(self.getRootFolder(), 'test')
@@ -208,7 +208,7 @@
 
     def test_conversion(self):
         self.getRootFolder()['test'] = TextTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # confirm that line terminators are converted correctly on post
         response = self.publish('/test/edit.html', form={

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_textwidget.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_textwidget.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/ftests/test_textwidget.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -17,7 +17,7 @@
 """
 import unittest
 from persistent import Persistent
-from transaction import get_transaction
+import transaction
 
 from zope.interface import Interface, implements
 from zope.schema import TextLine, Choice
@@ -62,7 +62,7 @@
 
     def test_display_editform(self):
         self.getRootFolder()['test'] = TextLineTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # display edit view
         response = self.publish('/test/edit.html')
@@ -83,7 +83,7 @@
 
     def test_submit_editform(self):
         self.getRootFolder()['test'] = TextLineTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit edit view
         response = self.publish('/test/edit.html', form={
@@ -108,7 +108,7 @@
         unicode.
         """
         self.getRootFolder()['test'] = TextLineTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit invalud type for text line
         response = self.publish('/test/edit.html', form={
@@ -124,7 +124,7 @@
 
     def test_missing_value(self):
         self.getRootFolder()['test'] = TextLineTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit missing values for s2 and s3
         response = self.publish('/test/edit.html', form={
@@ -144,7 +144,7 @@
 
     def test_required_validation(self):
         self.getRootFolder()['test'] = TextLineTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit missing values for required field s1
         response = self.publish('/test/edit.html', form={
@@ -162,7 +162,7 @@
 
     def test_invalid_value(self):
         self.getRootFolder()['test'] = TextLineTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit a value for s3 that isn't allowed
         response = self.publish('/test/edit.html', form={
@@ -174,7 +174,7 @@
 
     def test_length_validation(self):
         self.getRootFolder()['test'] = TextLineTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # submit value for s1 that is too short
         response = self.publish('/test/edit.html', form={
@@ -195,7 +195,7 @@
 
     def test_omitted_value(self):
         self.getRootFolder()['test'] = TextLineTest()
-        get_transaction().commit()
+        transaction.commit()
 
         # confirm default values
         object = traverse(self.getRootFolder(), 'test')

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/generations/browser/managers.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/generations/browser/managers.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/generations/browser/managers.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -15,6 +15,8 @@
 
 $Id$
 """
+import transaction
+
 from zope.app import zapi
 from zope.app.generations.interfaces import ISchemaManager
 from zope.app.generations.generations import generations_key, Context
@@ -33,7 +35,7 @@
         return self.request.publication.db
 
     def evolve(self):
-        """Perform a requested evolution 
+        """Perform a requested evolution
 
            This method needs to use the component architecture, so
            we'll set it up:
@@ -88,7 +90,7 @@
            We'll also increase the generation of app1:
 
              >>> app1.generation = 2
-             
+
            Now we can create our view:
 
              >>> view = Managers(None, request)
@@ -103,7 +105,7 @@
              2
 
            The demo evolver just writes the generation to a database key:
-           
+
              >>> from zope.app.generations.demo import key
              >>> conn.root()[key]
              (2,)
@@ -146,7 +148,7 @@
              2
              >>> conn.root()[key]
              (2,)
-           
+
            We'd better clean upp:
 
              >>> db.close()
@@ -172,12 +174,12 @@
                     generation += 1
                     manager.evolve(context, generation)
                     generations[key] = generation
-                    get_transaction().commit()
+                    transaction.commit()
                     return {'app': key, 'to': generation}
 
             return None
         finally:
-            get_transaction().abort()
+            transaction.abort()
             conn.close()
 
     def applications(self):
@@ -232,7 +234,7 @@
              >>> app1.generation += 1
 
            so we can evolve it.
-             
+
            Now we can create our view:
 
              >>> view = Managers(None, request)
@@ -245,7 +247,7 @@
              >>> data = list(view.applications())
              >>> data.sort(lambda d1, d2: cmp(d1['id'], d2['id']))
 
-             >>> for info in data:
+             >>> for info in data:  #doctest: +NORMALIZE_WHITESPACE
              ...     print info['id']
              ...     print info['min'], info['max'], info['generation']
              ...     print 'evolve?', info['evolve']
@@ -254,7 +256,7 @@
              evolve? evolve-app-foo.app1
              foo.app2
              0 0 0
-             evolve? 
+             evolve?
 
            We'd better clean upp:
 
@@ -273,7 +275,7 @@
                 manager = managers.get(key)
                 if manager is None:
                     continue
-                
+
                 result.append({
                     'id': key,
                     'min': manager.minimum_generation,

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/generations/generations.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/generations/generations.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/generations/generations.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -55,7 +55,7 @@
 
          >>> manager.evolve(context, 2)
          >>> manager.evolve(context, 3)
-         >>> get_transaction().commit()
+         >>> transaction.commit()
 
        The demo evolvers simply record their data in a root key:
 
@@ -301,7 +301,7 @@
         generations = root.get(generations_key)
         if generations is None:
             generations = root[generations_key] = PersistentDict()
-            get_transaction().commit()
+            transaction.commit()
 
         for key, manager in findManagers():
             generation = generations.get(key)
@@ -312,7 +312,7 @@
             if generation is None:
                 # This is a new database, so no old data
                 generations[key] = manager.generation
-                get_transaction().commit()
+                transaction.commit()
                 continue
 
             if generation > manager.generation:
@@ -337,10 +337,10 @@
                     transaction.begin()
                     manager.evolve(context, generation)
                     generations[key] = generation
-                    get_transaction().commit()
+                    transaction.commit()
                 except:
                     # An unguarded handler is intended here
-                    get_transaction().abort()
+                    transaction.abort()
                     logging.getLogger('zope.app.generations').exception(
                         "Failed to evolve database to generation %d for %s",
                         generation, key)

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/mail/tests/test_delivery.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/mail/tests/test_delivery.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/mail/tests/test_delivery.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -19,8 +19,8 @@
 """
 import os.path
 from tempfile import mktemp
-from unittest import TestCase, TestSuite, makeSuite
-from transaction import get_transaction
+from unittest import TestCase, TestSuite, makeSuite, main
+import transaction
 
 from zope.interface import implements
 from zope.interface.verify import verifyObject
@@ -76,7 +76,7 @@
         msgid = delivery.send(fromaddr, toaddrs, opt_headers + message)
         self.assertEquals(msgid, '20030519.1234 at example.org')
         self.assertEquals(mailer.sent_messages, [])
-        get_transaction().commit()
+        transaction.commit()
         self.assertEquals(mailer.sent_messages,
                           [(fromaddr, toaddrs, opt_headers + message)])
 
@@ -84,7 +84,7 @@
         msgid = delivery.send(fromaddr, toaddrs, message)
         self.assert_('@' in msgid)
         self.assertEquals(mailer.sent_messages, [])
-        get_transaction().commit()
+        transaction.commit()
         self.assertEquals(len(mailer.sent_messages), 1)
         self.assertEquals(mailer.sent_messages[0][0], fromaddr)
         self.assertEquals(mailer.sent_messages[0][1], toaddrs)
@@ -95,7 +95,7 @@
         mailer.sent_messages = []
         msgid = delivery.send(fromaddr, toaddrs, opt_headers + message)
         self.assertEquals(mailer.sent_messages, [])
-        get_transaction().abort()
+        transaction.abort()
         self.assertEquals(mailer.sent_messages, [])
 
 
@@ -203,7 +203,7 @@
         self.assertEquals(msgid, '20030519.1234 at example.org')
         self.assertEquals(MaildirWriterStub.commited_messages, [])
         self.assertEquals(MaildirWriterStub.aborted_messages, [])
-        get_transaction().commit()
+        transaction.commit()
         self.assertEquals(MaildirWriterStub.commited_messages,
                           [zope_headers + opt_headers + message])
         self.assertEquals(MaildirWriterStub.aborted_messages, [])
@@ -213,7 +213,7 @@
         self.assert_('@' in msgid)
         self.assertEquals(MaildirWriterStub.commited_messages, [])
         self.assertEquals(MaildirWriterStub.aborted_messages, [])
-        get_transaction().commit()
+        transaction.commit()
         self.assertEquals(len(MaildirWriterStub.commited_messages), 1)
         self.assert_(MaildirWriterStub.commited_messages[0].endswith(message))
         new_headers = MaildirWriterStub.commited_messages[0][:-len(message)]
@@ -226,7 +226,7 @@
         msgid = delivery.send(fromaddr, toaddrs, opt_headers + message)
         self.assertEquals(MaildirWriterStub.commited_messages, [])
         self.assertEquals(MaildirWriterStub.aborted_messages, [])
-        get_transaction().abort()
+        transaction.abort()
         self.assertEquals(MaildirWriterStub.commited_messages, [])
         self.assertEquals(len(MaildirWriterStub.aborted_messages), 1)
 
@@ -304,4 +304,4 @@
         ))
 
 if __name__ == '__main__':
-    unittest.main()
+    main()

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/publication/tests/test_browserpublication.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/publication/tests/test_browserpublication.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/publication/tests/test_browserpublication.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -129,12 +129,12 @@
             'tim', 'timbot', 'ai at its best')
 
         # now place our object inside the application
-        from transaction import get_transaction
+        import transaction
 
         connection = self.db.open()
         app = connection.root()['Application']
         app.somepath = ob
-        get_transaction().commit()
+        transaction.commit()
         connection.close()
 
         defineChecker(app.__class__, NamesChecker(somepath='xxx'))

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/publication/tests/test_zopepublication.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/publication/tests/test_zopepublication.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/publication/tests/test_zopepublication.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -22,6 +22,7 @@
 from persistent import Persistent
 from ZODB.DB import DB
 from ZODB.DemoStorage import DemoStorage
+import transaction
 
 from zope.interface.verify import verifyClass
 from zope.interface import implements, classImplements, implementedBy
@@ -130,7 +131,7 @@
             from zope.app.folder import rootFolder
             app = rootFolder()
             root[ZopePublication.root_name] = app
-            get_transaction().commit()
+            transaction.commit()
 
         connection.close()
         self.app = app
@@ -288,7 +289,7 @@
         self.assertEqual(self.request.response._cookies, {})
 
     def testAbortOrCommitTransaction(self):
-        txn = get_transaction()
+        txn = transaction.get()
         try:
             raise Exception
         except:
@@ -296,7 +297,7 @@
         self.publication.handleException(
             self.object, self.request, sys.exc_info(), retry_allowed=False)
         # assert that we get a new transaction
-        self.assert_(txn is not get_transaction())    
+        self.assert_(txn is not transaction.get())    
 
     def testAbortTransactionWithErrorLoggingService(self):
         # provide our fake error logging service
@@ -340,7 +341,7 @@
         f1.setSiteManager(ServiceManager(AuthService1()))
         f2 = f1['f2']
         f2.setSiteManager(ServiceManager(AuthService2()))
-        get_transaction().commit()
+        transaction.commit()
 
         from zope.app.container.interfaces import ISimpleReadContainer
         from zope.app.container.traversal import ContainerTraverser
@@ -373,13 +374,13 @@
 
     def testTransactionCommitAfterCall(self):
         root = self.db.open().root()
-        txn = get_transaction()
+        txn = transaction.get()
         # we just need a change in the database to make the
         # transaction notable in the undo log
         root['foo'] = object()
         last_txn_info = self.db.undoInfo()[0]
         self.publication.afterCall(self.request, self.object)
-        self.assert_(txn is not get_transaction())
+        self.assert_(txn is not transaction.get())
         new_txn_info = self.db.undoInfo()[0]
         self.failIfEqual(last_txn_info, new_txn_info)
 

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/publication/zopepublication.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/publication/zopepublication.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/publication/zopepublication.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -153,7 +153,7 @@
         return mapply(ob, request.getPositionalArguments(), request)
 
     def afterCall(self, request, ob):
-        txn = get_transaction()
+        txn = transaction.get()
         self.annotateTransaction(txn, request, ob)
 
         txn.commit()
@@ -222,17 +222,17 @@
             # the zope log.
 
             errService.raising(exc_info, request)
-            get_transaction().commit()
+            transaction.commit()
         except:
             tryToLogException(
                 'Error while reporting an error to the %s service' %
                 zapi.servicenames.ErrorLogging)
-            get_transaction().abort()
+            transaction.abort()
 
     def handleException(self, object, request, exc_info, retry_allowed=True):
         # This transaction had an exception that reached the publisher.
         # It must definitely be aborted.
-        get_transaction().abort()
+        transaction.abort()
 
         # Convert ConflictErrors to Retry exceptions.
         if retry_allowed and isinstance(exc_info[1], ConflictError):
@@ -303,7 +303,7 @@
             if view is not None:
                 try:
                     response.setBody(self.callObject(request, view))
-                    get_transaction().commit()
+                    transaction.commit()
                 except:
                     # Problem rendering the view for this exception.
                     # Log an error.
@@ -321,7 +321,7 @@
                 # because the view couldn't be rendered. In either case,
                 # we let the request handle it.
                 response.handleException(exc_info)
-                get_transaction().abort()
+                transaction.abort()
 
             # See if there's an IExceptionSideEffects adapter for the
             # exception
@@ -339,12 +339,12 @@
                     # Although request is passed in here, it should be
                     # considered read-only.
                     adapter(object, request, exc_info)
-                    get_transaction().commit()
+                    transaction.commit()
                 except:
                     tryToLogException(
                         'Exception while calling'
                         ' IExceptionSideEffects adapter')
-                    get_transaction().abort()
+                    transaction.abort()
 
     def beginErrorHandlingTransaction(self, request, ob, note):
         txn = transaction.begin()

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/rdb/tests/test_zopeconnection.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/rdb/tests/test_zopeconnection.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/rdb/tests/test_zopeconnection.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -38,7 +38,7 @@
         cursor.execute('select * from blah')
 
         self.assertEqual(zc._txn_registered, True)
-        self.assertEqual(len(transaction.get_transaction()._resources), 1)
+        self.assertEqual(len(transaction.get()._resources), 1)
 
     def test_commit(self):
         transaction.begin()

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/rdb/tests/test_zopedbtransactionmanager.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/rdb/tests/test_zopedbtransactionmanager.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/rdb/tests/test_zopedbtransactionmanager.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -16,7 +16,7 @@
 $Id$
 """
 from unittest import TestCase, main, makeSuite, TestSuite
-from transaction import get_transaction
+import transaction
 from transaction.tests.abstestIDataManager import IDataManagerTests
 from zope.app.rdb import ZopeDBTransactionManager
 from zope.app.rdb import ZopeConnection
@@ -29,18 +29,18 @@
         zc = ZopeConnection(self.conn, TypeInfoStub())
         self.datamgr = ZopeDBTransactionManager(zc)
         zc.registerForTxn()
-        self.txn_factory = get_transaction
+        self.txn_factory = transaction.get
 
     def tearDown(self):
         """ make sure the global env is clean"""
-        get_transaction().abort()
+        transaction.abort()
 
     def test_abort(self):
-        get_transaction().abort()
+        transaction.abort()
         self.assertEqual(self.conn._called.get('rollback'), 1)
 
     def test_commit(self):
-        get_transaction().commit()
+        transaction.commit()
         self.assertEqual(self.conn._called.get('commit'), 1)
 
 
@@ -58,19 +58,19 @@
         self.datamgr1 = ZopeDBTransactionManager(zc2)
         zc1.registerForTxn()
         zc2.registerForTxn()
-        self.txn_factory = get_transaction
+        self.txn_factory = transaction.get
 
     def tearDown(self):
         """ make sure the global env is clean"""
-        get_transaction().abort()
+        transaction.abort()
 
     def test_abort(self):
-        get_transaction().abort()
+        transaction.abort()
         self.assertEqual(self.conn1._called.get('rollback'), 1)
         self.assertEqual(self.conn2._called.get('rollback'), 1)
 
     def test_commit(self):
-        get_transaction().commit()
+        transaction.commit()
         self.assertEqual(self.conn1._called.get('commit'), 1)
         self.assertEqual(self.conn2._called.get('commit'), 1)
 

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/site/service.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/site/service.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/site/service.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -26,7 +26,6 @@
 $Id$
 """
 import sys
-from transaction import get_transaction
 
 import zope.event
 import zope.interface

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/site/servicecontainer.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/site/servicecontainer.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/site/servicecontainer.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -18,7 +18,6 @@
 
 import zope.interface
 
-from transaction import get_transaction
 from zope.app.container.contained import Contained
 from zope.app.site.interfaces import IPossibleSite, ISite
 from zope.component.exceptions import ComponentLookupError

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/traversing/ftests/test_vhosting.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/traversing/ftests/test_vhosting.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/traversing/ftests/test_vhosting.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -19,7 +19,7 @@
 from zope.app.tests import ztapi
 from zope.app.tests.functional import BrowserTestCase
 from zope.app.folder import Folder
-from transaction import get_transaction
+import transaction
 from zope.app.publisher.browser.resource import Resource
 from zope.app.traversing.api import traverse
 from zope.security.checker import defineChecker, NamesChecker, NoProxy
@@ -151,7 +151,7 @@
     def createObject(self, path, obj):
         folder, id = self.createFolders(path)
         folder[id] = obj
-        get_transaction().commit()
+        transaction.commit()
 
     def addPage(self, path, content):
         page = ZPTPage()

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/undo/__init__.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/undo/__init__.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/undo/__init__.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -16,6 +16,8 @@
 $Id$
 """
 from datetime import datetime
+
+import transaction
 from zope.interface import implements
 from zope.exceptions import NotFoundError
 
@@ -181,4 +183,4 @@
     def _undo(self, ids):
         for id in ids:
             self.__db.undo(id)
-        get_transaction().setExtendedInfo('undo', True)
+        transaction.get().setExtendedInfo('undo', True)

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/undo/tests/test_zodbundomanager.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/undo/tests/test_zodbundomanager.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/undo/tests/test_zodbundomanager.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -17,7 +17,7 @@
 """
 from time import time
 from unittest import TestCase, main, makeSuite
-from transaction import get_transaction
+import transaction
 
 from zope.testing.cleanup import CleanUp 
 from zope.app.tests import ztapi
@@ -138,7 +138,7 @@
         self.assertEqual(list(self.undo.getTransactions()), expected)
 
         # assert that the transaction has been annotated
-        txn = get_transaction()
+        txn = transaction.get()
         self.assert_(txn._extension.has_key('undo'))
         self.assert_(txn._extension['undo'] is True)
 

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/utility/browser/ftests.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/utility/browser/ftests.py	2005-07-26 01:15:21 UTC (rev 37423)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/utility/browser/ftests.py	2005-07-26 01:26:35 UTC (rev 37424)
@@ -40,7 +40,7 @@
         rm = default.getRegistrationManager()
         rm.addRegistration(reg)
         reg.status = "Active"
-        transaction.get_transaction().commit()
+        transaction.commit()
         # now let's take a look at the Utilities page:
         response = self.publish(
             "/++etc++site/default/Utilities/@@utilities.html",



More information about the Zope3-Checkins mailing list