[Erp5-report] r34331 jerome - /erp5/trunk/products/ERP5Type/Utils.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Apr 7 18:30:59 CEST 2010


Author: jerome
Date: Wed Apr  7 18:30:57 2010
New Revision: 34331

URL: http://svn.erp5.org?rev=34331&view=rev
Log:
when writing a local property sheet, constraint or document, try to load the
file, to detect errors immediatly


Modified:
    erp5/trunk/products/ERP5Type/Utils.py

Modified: erp5/trunk/products/ERP5Type/Utils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Utils.py?rev=34331&r1=34330&r2=34331&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Utils.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Utils.py [utf8] Wed Apr  7 18:30:57 2010
@@ -564,6 +564,9 @@
     f.write(text)
   finally:
     f.close()
+  # load the file, so that an error is raised if file is invalid
+  module = imp.load_source(class_id, path)
+  getattr(module, class_id)
 
 def importLocalPropertySheet(class_id, path = None):
   from Products.ERP5Type import PropertySheet
@@ -771,6 +774,9 @@
     f.write(text)
   finally:
     f.close()
+  # load the file, so that an error is raised if file is invalid
+  module = imp.load_source(class_id, path)
+  getattr(module, class_id)
 
 def removeLocalConstraint(class_id):
   instance_home = getConfiguration().instancehome
@@ -826,6 +832,9 @@
     f.write(text)
   finally:
     f.close()
+  # load the file, so that an error is raised if file is invalid
+  module = imp.load_source(class_id, path)
+  getattr(module, class_id)
 
 def setDefaultClassProperties(property_holder):
   """Initialize default properties for ERP5Type Documents.




More information about the Erp5-report mailing list