[CMF-checkins] CVS: Products/CMFCore/tests/base -
testcase.py:1.10.10.2
Yvo Schubbe
y.2005- at wcm-solutions.de
Tue Apr 5 05:25:50 EDT 2005
Update of /cvs-repository/Products/CMFCore/tests/base
In directory cvs.zope.org:/tmp/cvs-serv3869/CMFCore/tests/base
Modified Files:
Tag: CMF-1_5-branch
testcase.py
Log Message:
- replaced get_transaction() by the transaction API used in Zope 2.8
- added utils.transaction for Zope 2.7 compatibility
- replaced commit() by commit(1) in test_PortalFolder.py
- related import and whitespace cleanup
=== Products/CMFCore/tests/base/testcase.py 1.10.10.1 => 1.10.10.2 ===
--- Products/CMFCore/tests/base/testcase.py:1.10.10.1 Thu Mar 10 09:38:21 2005
+++ Products/CMFCore/tests/base/testcase.py Tue Apr 5 05:25:19 2005
@@ -1,6 +1,10 @@
from unittest import TestCase
-import Zope
-Zope.startup()
+try:
+ import Zope2
+except ImportError:
+ # BBB: for Zope 2.7
+ import Zope as Zope2
+Zope2.startup()
from os import curdir, mkdir, stat, remove
from os.path import join, abspath, dirname
@@ -12,21 +16,27 @@
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
from AccessControl.SecurityManager import setSecurityPolicy
-from security import PermissiveSecurityPolicy, AnonymousUser
from Testing.makerequest import makerequest
+try:
+ import transaction
+except ImportError:
+ # BBB: for Zope 2.7
+ from Products.CMFCore.utils import transaction
from dummy import DummyFolder
+from security import AnonymousUser
+from security import PermissiveSecurityPolicy
class TransactionalTest( TestCase ):
def setUp( self ):
- get_transaction().begin()
- self.connection = Zope.DB.open()
+ transaction.begin()
+ self.connection = Zope2.DB.open()
self.root = self.connection.root()[ 'Application' ]
def tearDown( self ):
- get_transaction().abort()
+ transaction.abort()
self.connection.close()
@@ -42,15 +52,15 @@
class SecurityTest( TestCase ):
def setUp(self):
- get_transaction().begin()
+ transaction.begin()
self._policy = PermissiveSecurityPolicy()
self._oldPolicy = setSecurityPolicy(self._policy)
- self.connection = Zope.DB.open()
+ self.connection = Zope2.DB.open()
self.root = self.connection.root()[ 'Application' ]
newSecurityManager( None, AnonymousUser().__of__( self.root ) )
def tearDown( self ):
- get_transaction().abort()
+ transaction.abort()
self.connection.close()
noSecurityManager()
setSecurityPolicy(self._oldPolicy)
More information about the CMF-checkins
mailing list