[Erp5-report] r38023 nicolas.dumazet - /erp5/trunk/products/ERP5Type/Utils.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Aug 26 09:45:24 CEST 2010
Author: nicolas.dumazet
Date: Thu Aug 26 09:45:21 2010
New Revision: 38023
URL: http://svn.erp5.org?rev=38023&view=rev
Log:
try to raise an useful error in case of a typo in a PropertySheet
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=38023&r1=38022&r2=38023&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Utils.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Utils.py [utf8] Thu Aug 26 09:45:21 2010
@@ -633,9 +633,15 @@ def importLocalPropertySheet(class_id, p
f = open(path)
try:
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
- registerBaseCategories(getattr(module, class_id))
+ registerBaseCategories(klass)
finally:
f.close()
More information about the Erp5-report
mailing list