[CMF-checkins] CVS: Products/CMFDefault/tests - test_Image.py:1.12

Yvo Schubbe y.2005- at wcm-solutions.de
Tue Apr 5 05:26:55 EDT 2005


Update of /cvs-repository/Products/CMFDefault/tests
In directory cvs.zope.org:/tmp/cvs-serv4750/CMFDefault/tests

Modified Files:
	test_Image.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/CMFDefault/tests/test_Image.py 1.11 => 1.12 ===
--- Products/CMFDefault/tests/test_Image.py:1.11	Sun Mar 20 16:19:47 2005
+++ Products/CMFDefault/tests/test_Image.py	Tue Apr  5 05:26:55 2005
@@ -17,21 +17,31 @@
 
 from unittest import TestCase, TestSuite, makeSuite, main
 import Testing
-import Zope
-Zope.startup()
+try:
+    import Zope2
+except ImportError:
+    # BBB: for Zope 2.7
+    import Zope as Zope2
+Zope2.startup()
 
 from os.path import join as path_join
 from cStringIO import StringIO
 
+from AccessControl.SecurityManagement import newSecurityManager
+from AccessControl.SecurityManagement import noSecurityManager
+from AccessControl.User import UnrestrictedUser
+try:
+    import transaction
+except ImportError:
+    # BBB: for Zope 2.7
+    from Products.CMFCore.utils import transaction
+
 from Products.CMFCore.tests.base.dummy import DummySite
 from Products.CMFCore.tests.base.dummy import DummyTool
 from Products.CMFCore.tests.base.testcase import RequestTest
 from Products.CMFDefault import tests
 from Products.CMFDefault.File import File
 from Products.CMFDefault.Image import Image
-from AccessControl.SecurityManagement import newSecurityManager
-from AccessControl.SecurityManagement import noSecurityManager
-from AccessControl.User import UnrestrictedUser
 
 TESTS_HOME = tests.__path__[0]
 TEST_JPG = path_join(TESTS_HOME, 'TestImage.jpg')
@@ -99,7 +109,7 @@
             self.site.invokeFactory('Folder', id='subfolder')
             self.subfolder = self.site.subfolder
             self.workflow = self.site.portal_workflow
-            get_transaction().commit(1) # Make sure we have _p_jars
+            transaction.commit(1) # Make sure we have _p_jars
         except:
             self.tearDown()
             raise



More information about the CMF-checkins mailing list