mirror of
https://github.com/jazzband/django-configurations.git
synced 2026-03-16 22:20:27 +00:00
Don't catch AttributeError during cls init
if obj = cls() do have an attribute error inside it's initialization, it will appears as if the module could not be find. which is hard to troubleshoot, when the module is really there :)
This commit is contained in:
parent
a8917a7a87
commit
8b78278921
1 changed files with 5 additions and 1 deletions
|
|
@ -62,11 +62,15 @@ class SettingsLoader(object):
|
|||
mod = imp.load_module(fullname, *self.location)
|
||||
try:
|
||||
cls = getattr(mod, self.name)
|
||||
obj = cls()
|
||||
except AttributeError: # pragma: no cover
|
||||
raise ImproperlyConfigured("Couldn't find settings '%s' in "
|
||||
"module '%s'" %
|
||||
(self.name, mod.__package__))
|
||||
try:
|
||||
obj = cls()
|
||||
except Exception, err:
|
||||
raise ImproperlyConfigured("Couldn't load settings '%s.%s': %s" %
|
||||
(mod.__name__, self.name, err))
|
||||
for name, value in uppercase_attributes(obj).items():
|
||||
if callable(value):
|
||||
value = value()
|
||||
|
|
|
|||
Loading…
Reference in a new issue