[Erp5-report] r31918 nicolas - /erp5/trunk/products/ERP5Type/Utils.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jan 22 16:30:55 CET 2010


Author: nicolas
Date: Fri Jan 22 16:30:55 2010
New Revision: 31918

URL: http://svn.erp5.org?rev=31918&view=rev
Log:
Display traceback when import fails, reviewed by Romain

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=31918&r1=31917&r2=31918&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Utils.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Utils.py [utf8] Fri Jan 22 16:30:55 2010
@@ -33,6 +33,7 @@
 import string
 import time
 import warnings
+import sys
 try:
   # Python 2.5 or later
   from hashlib import md5 as md5_new
@@ -71,6 +72,7 @@
 from Products.ERP5Type.Accessor.Interface import Getter as InterfaceGetter
 from Products.ERP5Type.Cache import getReadOnlyTransactionCache
 from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
+from zExceptions import ExceptionFormatter
 from zLOG import LOG, BLATHER, PROBLEM, WARNING
 
 #####################################################
@@ -1122,8 +1124,10 @@
   try:
     consistency_class = getattr(Constraint, constraint_definition['type'])
   except AttributeError:
-    LOG("ERP5Type", PROBLEM, "Can not find Constraint: %s" % \
-                       constraint_definition['type'])
+    exc_info = sys.exc_info()
+    LOG("ERP5Type", PROBLEM, "Can not find Constraint: %s\n%s" % \
+                      (constraint_definition['type'],
+                      ''.join(ExceptionFormatter.format_exception(*exc_info))))
     raise ConstraintNotFound(repr(constraint_definition))
   consistency_instance = consistency_class(**constraint_definition)
   property_holder.constraints += [consistency_instance]




More information about the Erp5-report mailing list