[Erp5-report] r12713 - in /erp5/trunk/products/ERP5Type: Tool/ tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Feb 15 10:43:02 CET 2007


Author: jerome
Date: Thu Feb 15 10:42:58 2007
New Revision: 12713

URL: http://svn.erp5.org?rev=12713&view=rev
Log:
Temporary files are not always created in the same partition that instance home, so we cannot use os.rename.

Update PropertySheetTestCase to commit transactions when creating and editing property sheets.


Modified:
    erp5/trunk/products/ERP5Type/Tool/ClassTool.py
    erp5/trunk/products/ERP5Type/tests/testERP5Type.py

Modified: erp5/trunk/products/ERP5Type/Tool/ClassTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Tool/ClassTool.py?rev=12713&r1=12712&r2=12713&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Tool/ClassTool.py (original)
+++ erp5/trunk/products/ERP5Type/Tool/ClassTool.py Thu Feb 15 10:42:58 2007
@@ -25,6 +25,10 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
 ##############################################################################
+
+import os
+import shutil
+import tempfile
 
 from Products.CMFCore.utils import UniqueObject
 
@@ -35,7 +39,6 @@
 from App.config import getConfiguration
 from Products.ERP5Type.TM import VTM as TM
 from Products.PageTemplates.PageTemplateFile import PageTemplateFile
-import os, tempfile
 
 from Products.ERP5Type import Permissions
 from Products.ERP5Type import _dtmldir
@@ -888,7 +891,7 @@
               os.remove(destination_file)
             except OSError:
               pass
-            os.rename(source_file, destination_file)
+            shutil.move(source_file, destination_file)
         self.deleteTemporaryInstanceHome()
 
       security.declareProtected( Permissions.ManageExtensions, 'writeLocalPropertySheet' )

Modified: erp5/trunk/products/ERP5Type/tests/testERP5Type.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testERP5Type.py?rev=12713&r1=12712&r2=12713&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testERP5Type.py (original)
+++ erp5/trunk/products/ERP5Type/tests/testERP5Type.py Thu Feb 15 10:42:58 2007
@@ -78,7 +78,11 @@
     class_tool = self.getClassTool()
 
     class_tool.newPropertySheet(property_sheet_name)
+    # XXX need to commit the transaction at this point, because class tool
+    # files are no longer available to the current transaction.
+    get_transaction().commit()
     class_tool.editPropertySheet(property_sheet_name, property_sheet_code)
+    get_transaction().commit()
     class_tool.importPropertySheet(property_sheet_name)
     
     # We set the property sheet on the portal type




More information about the Erp5-report mailing list