Commit f4983d26 authored by Jérome Perrin's avatar Jérome Perrin

when writing a local property sheet, constraint or document, try to load the

file, to detect errors immediatly



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34331 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9189a8c7
...@@ -564,6 +564,9 @@ def writeLocalPropertySheet(class_id, text, create=1, instance_home=None): ...@@ -564,6 +564,9 @@ def writeLocalPropertySheet(class_id, text, create=1, instance_home=None):
f.write(text) f.write(text)
finally: finally:
f.close() 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): def importLocalPropertySheet(class_id, path = None):
from Products.ERP5Type import PropertySheet from Products.ERP5Type import PropertySheet
...@@ -771,6 +774,9 @@ def writeLocalConstraint(class_id, text, create=1, instance_home=None): ...@@ -771,6 +774,9 @@ def writeLocalConstraint(class_id, text, create=1, instance_home=None):
f.write(text) f.write(text)
finally: finally:
f.close() 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): def removeLocalConstraint(class_id):
instance_home = getConfiguration().instancehome instance_home = getConfiguration().instancehome
...@@ -826,6 +832,9 @@ def writeLocalDocument(class_id, text, create=1, instance_home=None): ...@@ -826,6 +832,9 @@ def writeLocalDocument(class_id, text, create=1, instance_home=None):
f.write(text) f.write(text)
finally: finally:
f.close() 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): def setDefaultClassProperties(property_holder):
"""Initialize default properties for ERP5Type Documents. """Initialize default properties for ERP5Type Documents.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment