[Zope3-checkins] SVN: Zope3/trunk/src/zope/configuration/config.py
Distinguish better between Python code bugs and configuration
errors.
Shane Hathaway
shane at zope.com
Wed Nov 10 15:19:35 EST 2004
Log message for revision 28420:
Distinguish better between Python code bugs and configuration errors.
If configuration refers to a module that does not exist, that's a
configuration error. If the module does exist but an ImportError still
occurs, the module was probably partially imported and there is a Python
code bug.
Changed:
U Zope3/trunk/src/zope/configuration/config.py
-=-
Modified: Zope3/trunk/src/zope/configuration/config.py
===================================================================
--- Zope3/trunk/src/zope/configuration/config.py 2004-11-10 20:15:41 UTC (rev 28419)
+++ Zope3/trunk/src/zope/configuration/config.py 2004-11-10 20:19:35 UTC (rev 28420)
@@ -178,6 +178,11 @@
try:
mod = __import__(mname, *_import_chickens)
except ImportError, v:
+ if sys.modules.has_key(mname):
+ # The module was at least partially imported, so there
+ # is probably a bug in some Python code rather than a
+ # configuration error.
+ raise
raise ConfigurationError, (
"Couldn't import %s, %s" % (mname, v)
), sys.exc_info()[2]
More information about the Zope3-Checkins
mailing list