mirror of https://github.com/python/cpython
Logging: improved error reporting for BaseConfigurator.resolve().
This commit is contained in:
parent
27c72e9e5c
commit
3b4849a21d
|
@ -387,15 +387,21 @@ class BaseConfigurator(object):
|
||||||
"""
|
"""
|
||||||
name = s.split('.')
|
name = s.split('.')
|
||||||
used = name.pop(0)
|
used = name.pop(0)
|
||||||
found = self.importer(used)
|
try:
|
||||||
for frag in name:
|
found = self.importer(used)
|
||||||
used += '.' + frag
|
for frag in name:
|
||||||
try:
|
used += '.' + frag
|
||||||
found = getattr(found, frag)
|
try:
|
||||||
except AttributeError:
|
found = getattr(found, frag)
|
||||||
self.importer(used)
|
except AttributeError:
|
||||||
found = getattr(found, frag)
|
self.importer(used)
|
||||||
return found
|
found = getattr(found, frag)
|
||||||
|
return found
|
||||||
|
except ImportError:
|
||||||
|
e, tb = sys.exc_info()[1:]
|
||||||
|
v = ValueError('Cannot resolve %r: %s' % (s, e))
|
||||||
|
v.__cause__, v.__traceback__ = e, tb
|
||||||
|
raise v
|
||||||
|
|
||||||
def ext_convert(self, value):
|
def ext_convert(self, value):
|
||||||
"""Default converter for the ext:// protocol."""
|
"""Default converter for the ext:// protocol."""
|
||||||
|
|
Loading…
Reference in New Issue