Commit 6319ef54 authored by Nicolas Delaby's avatar Nicolas Delaby

Display traceback when import fails, reviewed by Romain

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31918 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3e2487d3
...@@ -33,6 +33,7 @@ import re ...@@ -33,6 +33,7 @@ import re
import string import string
import time import time
import warnings import warnings
import sys
try: try:
# Python 2.5 or later # Python 2.5 or later
from hashlib import md5 as md5_new from hashlib import md5 as md5_new
...@@ -71,6 +72,7 @@ from Products.ERP5Type.Accessor.Constant import Getter as ConstantGetter ...@@ -71,6 +72,7 @@ from Products.ERP5Type.Accessor.Constant import Getter as ConstantGetter
from Products.ERP5Type.Accessor.Interface import Getter as InterfaceGetter from Products.ERP5Type.Accessor.Interface import Getter as InterfaceGetter
from Products.ERP5Type.Cache import getReadOnlyTransactionCache from Products.ERP5Type.Cache import getReadOnlyTransactionCache
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from zExceptions import ExceptionFormatter
from zLOG import LOG, BLATHER, PROBLEM, WARNING from zLOG import LOG, BLATHER, PROBLEM, WARNING
##################################################### #####################################################
...@@ -1122,8 +1124,10 @@ def createConstraintList(property_holder, constraint_definition): ...@@ -1122,8 +1124,10 @@ def createConstraintList(property_holder, constraint_definition):
try: try:
consistency_class = getattr(Constraint, constraint_definition['type']) consistency_class = getattr(Constraint, constraint_definition['type'])
except AttributeError: except AttributeError:
LOG("ERP5Type", PROBLEM, "Can not find Constraint: %s" % \ exc_info = sys.exc_info()
constraint_definition['type']) LOG("ERP5Type", PROBLEM, "Can not find Constraint: %s\n%s" % \
(constraint_definition['type'],
''.join(ExceptionFormatter.format_exception(*exc_info))))
raise ConstraintNotFound(repr(constraint_definition)) raise ConstraintNotFound(repr(constraint_definition))
consistency_instance = consistency_class(**constraint_definition) consistency_instance = consistency_class(**constraint_definition)
property_holder.constraints += [consistency_instance] property_holder.constraints += [consistency_instance]
......
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