Commit 4fb74f18 authored by Nicolas Dumazet's avatar Nicolas Dumazet

try to raise an useful error in case of a typo in a PropertySheet


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38023 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 52e10973
...@@ -633,9 +633,15 @@ def importLocalPropertySheet(class_id, path = None): ...@@ -633,9 +633,15 @@ def importLocalPropertySheet(class_id, path = None):
f = open(path) f = open(path)
try: try:
module = imp.load_source(class_id, path, f) module = imp.load_source(class_id, path, f)
setattr(PropertySheet, class_id, getattr(module, class_id)) klass = None
try:
klass = getattr(module, class_id)
except AttributeError:
raise AttributeError("Property Sheet '%s' should contain a class " \
"with the same name" % class_id)
setattr(PropertySheet, class_id, klass)
# Register base categories # Register base categories
registerBaseCategories(getattr(module, class_id)) registerBaseCategories(klass)
finally: finally:
f.close() f.close()
......
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