Skip to content

Commit

Permalink
Raise ImproperlyConfigured when settings cause an error
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Mar 19, 2013
1 parent 9aa6b2a commit b940f05
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions logan/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"""

import sys
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
from logan.settings import load_settings, create_module

Expand Down Expand Up @@ -63,6 +64,13 @@ def __init__(self, name, config_path, default_settings=None, allow_extras=True,
self.callback = callback

def load_module(self, fullname):
try:
return self._load_module(fullname)
except Exception as e:
exc_info = sys.exc_info()
raise ImproperlyConfigured, repr(e), exc_info[2]

def _load_module(self, fullname):
# TODO: is this needed?
if fullname in sys.modules:
return sys.modules[fullname] # pragma: no cover
Expand Down

0 comments on commit b940f05

Please sign in to comment.