[Zope-Checkins] SVN: Zope/trunk/lib/python/ Changes for ZODB 3.3:
Tim Peters
tim.one at comcast.net
Mon Sep 27 16:38:05 EDT 2004
Log message for revision 27697:
Changes for ZODB 3.3:
1. a_Transaction_object.begin() is deprecated. Don't use it.
2. Commit failure is "sticky" now: the current transaction
must be explicitly discarded (abort() or begin()) before
a commit can succeed again.
Changed:
U Zope/trunk/lib/python/AccessControl/tests/testBindings.py
U Zope/trunk/lib/python/AccessControl/tests/testUserFolder.py
U Zope/trunk/lib/python/OFS/tests/testCopySupport.py
U Zope/trunk/lib/python/OFS/tests/testFileAndImage.py
U Zope/trunk/lib/python/OFS/tests/testTraverse.py
U Zope/trunk/lib/python/Products/SiteAccess/tests/testVirtualHostMonster.py
U Zope/trunk/lib/python/Products/SiteErrorLog/tests/testSiteErrorLog.py
U Zope/trunk/lib/python/Products/Transience/TransactionHelper.py
U Zope/trunk/lib/python/Products/Transience/tests/testTransactionHelper.py
-=-
Modified: Zope/trunk/lib/python/AccessControl/tests/testBindings.py
===================================================================
--- Zope/trunk/lib/python/AccessControl/tests/testBindings.py 2004-09-27 19:46:48 UTC (rev 27696)
+++ Zope/trunk/lib/python/AccessControl/tests/testBindings.py 2004-09-27 20:38:05 UTC (rev 27697)
@@ -18,6 +18,7 @@
import unittest
import ZODB
+import transaction
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo
from Globals import InitializeClass
@@ -95,7 +96,7 @@
def setUp(self):
from Testing.ZODButil import makeDB
- get_transaction().begin()
+ transaction.begin()
self.db = makeDB()
self.connection = self.db.open()
Modified: Zope/trunk/lib/python/AccessControl/tests/testUserFolder.py
===================================================================
--- Zope/trunk/lib/python/AccessControl/tests/testUserFolder.py 2004-09-27 19:46:48 UTC (rev 27696)
+++ Zope/trunk/lib/python/AccessControl/tests/testUserFolder.py 2004-09-27 20:38:05 UTC (rev 27697)
@@ -20,6 +20,8 @@
from Testing.makerequest import makerequest
+import transaction
+
import Zope
Zope.startup()
@@ -33,7 +35,7 @@
class UserFolderTests(unittest.TestCase):
def setUp(self):
- get_transaction().begin()
+ transaction.begin()
self.app = makerequest(Zope.app())
try:
# Set up a user and role
Modified: Zope/trunk/lib/python/OFS/tests/testCopySupport.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testCopySupport.py 2004-09-27 19:46:48 UTC (rev 27696)
+++ Zope/trunk/lib/python/OFS/tests/testCopySupport.py 2004-09-27 20:38:05 UTC (rev 27697)
@@ -3,6 +3,7 @@
from mimetools import Message
from multifile import MultiFile
+import transaction
from AccessControl import SecurityManager
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
@@ -90,7 +91,7 @@
except:
self.connection.close()
raise
- get_transaction().begin()
+ transaction.begin()
return self.app._getOb( 'folder1' ), self.app._getOb( 'folder2' )
Modified: Zope/trunk/lib/python/OFS/tests/testFileAndImage.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testFileAndImage.py 2004-09-27 19:46:48 UTC (rev 27696)
+++ Zope/trunk/lib/python/OFS/tests/testFileAndImage.py 2004-09-27 20:38:05 UTC (rev 27697)
@@ -12,6 +12,7 @@
from App.Common import rfc1123_date
from Testing.makerequest import makerequest
from zExceptions import Redirect
+import transaction
try:
here = os.path.dirname(os.path.abspath(__file__))
@@ -99,7 +100,7 @@
except:
self.connection.close()
raise
- get_transaction().begin()
+ transaction.begin()
self.file = getattr( self.app, 'file' )
def tearDown( self ):
Modified: Zope/trunk/lib/python/OFS/tests/testTraverse.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testTraverse.py 2004-09-27 19:46:48 UTC (rev 27696)
+++ Zope/trunk/lib/python/OFS/tests/testTraverse.py 2004-09-27 20:38:05 UTC (rev 27697)
@@ -15,7 +15,7 @@
import os, sys, unittest
import string, cStringIO, re
-import ZODB, Acquisition
+import ZODB, Acquisition, transaction
from Acquisition import aq_base
from OFS.Application import Application
from OFS.Folder import manage_addFolder
@@ -141,7 +141,7 @@
except:
self.connection.close()
raise
- get_transaction().begin()
+ transaction.begin()
self.folder1 = getattr( self.app, 'folder1' )
self.policy = UnitTestSecurityPolicy()
Modified: Zope/trunk/lib/python/Products/SiteAccess/tests/testVirtualHostMonster.py
===================================================================
--- Zope/trunk/lib/python/Products/SiteAccess/tests/testVirtualHostMonster.py 2004-09-27 19:46:48 UTC (rev 27696)
+++ Zope/trunk/lib/python/Products/SiteAccess/tests/testVirtualHostMonster.py 2004-09-27 20:38:05 UTC (rev 27697)
@@ -15,13 +15,15 @@
import Zope
Zope.startup()
+import transaction
+
import unittest
class VHMRegressions(unittest.TestCase):
def setUp(self):
- get_transaction().begin()
+ transaction.begin()
self.app = makerequest(Zope.app())
try:
self.app.manage_addProduct['SiteAccess'].manage_addVirtualHostMonster('VHM')
Modified: Zope/trunk/lib/python/Products/SiteErrorLog/tests/testSiteErrorLog.py
===================================================================
--- Zope/trunk/lib/python/Products/SiteErrorLog/tests/testSiteErrorLog.py 2004-09-27 19:46:48 UTC (rev 27696)
+++ Zope/trunk/lib/python/Products/SiteErrorLog/tests/testSiteErrorLog.py 2004-09-27 20:38:05 UTC (rev 27697)
@@ -10,6 +10,8 @@
import Zope
Zope.startup()
+import transaction
+
import sys
import unittest
@@ -17,7 +19,7 @@
class SiteErrorLogTests(unittest.TestCase):
def setUp(self):
- get_transaction().begin()
+ transaction.begin()
self.app = makerequest(Zope.app())
try:
self.app.manage_addDTMLMethod('doc', '')
Modified: Zope/trunk/lib/python/Products/Transience/TransactionHelper.py
===================================================================
--- Zope/trunk/lib/python/Products/Transience/TransactionHelper.py 2004-09-27 19:46:48 UTC (rev 27696)
+++ Zope/trunk/lib/python/Products/Transience/TransactionHelper.py 2004-09-27 20:38:05 UTC (rev 27697)
@@ -13,8 +13,8 @@
self.reason = reason
self.time = time.time()
- def sort_key(self):
- return self.time()
+ def sortKey(self):
+ return str(id(self))
def tpc_begin(self, *arg, **kw):
pass
@@ -25,6 +25,9 @@
def tpc_vote(self, transaction):
raise PreventTransactionCommit(self.reason)
+ def abort(*args):
+ pass
+
class makeTransactionUncommittable:
"""
- register an uncommittable object with the provided transaction
Modified: Zope/trunk/lib/python/Products/Transience/tests/testTransactionHelper.py
===================================================================
--- Zope/trunk/lib/python/Products/Transience/tests/testTransactionHelper.py 2004-09-27 19:46:48 UTC (rev 27696)
+++ Zope/trunk/lib/python/Products/Transience/tests/testTransactionHelper.py 2004-09-27 20:38:05 UTC (rev 27697)
@@ -16,6 +16,7 @@
sys.path.insert(0, '../../..')
import ZODB
+import transaction
from unittest import TestCase, TestSuite, TextTestRunner, makeSuite
from Products.Transience.TransactionHelper import PreventTransactionCommit, \
makeTransactionUncommittable
@@ -30,6 +31,7 @@
def testUncommittable(self):
makeTransactionUncommittable(self.t, "test")
self.assertRaises(PreventTransactionCommit, get_transaction().commit)
+ transaction.abort()
def test_suite():
suite = makeSuite(TestTransactionHelper, 'test')
More information about the Zope-Checkins
mailing list