Moved django.core.handler.ImproperlyConfigured into django.core.exceptions
git-svn-id: http://code.djangoproject.com/svn/django/trunk@120 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
980b3ce696
commit
60bdadb9a3
|
@ -24,3 +24,7 @@ class ViewDoesNotExist(Exception):
|
||||||
class MiddlewareNotUsed(Exception):
|
class MiddlewareNotUsed(Exception):
|
||||||
"This middleware is not used in this server configuration"
|
"This middleware is not used in this server configuration"
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class ImproperlyConfigured(Exception):
|
||||||
|
"Django is somehow improperly configured"
|
||||||
|
pass
|
||||||
|
|
|
@ -5,9 +5,6 @@ from django.utils import httpwrappers
|
||||||
# settings) until after CoreHandler has been called; otherwise os.environ
|
# settings) until after CoreHandler has been called; otherwise os.environ
|
||||||
# won't be set up correctly (with respect to settings).
|
# won't be set up correctly (with respect to settings).
|
||||||
|
|
||||||
class ImproperlyConfigured(Exception):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class CoreHandler:
|
class CoreHandler:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -57,11 +54,11 @@ class CoreHandler:
|
||||||
try:
|
try:
|
||||||
mod = __import__(mw_module, '', '', [''])
|
mod = __import__(mw_module, '', '', [''])
|
||||||
except ImportError, e:
|
except ImportError, e:
|
||||||
raise ImproperlyConfigured, 'Error importing middleware %s: "%s"' % (mw_module, e)
|
raise exceptions.ImproperlyConfigured, 'Error importing middleware %s: "%s"' % (mw_module, e)
|
||||||
try:
|
try:
|
||||||
mw_class = getattr(mod, mw_classname)
|
mw_class = getattr(mod, mw_classname)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
raise ImproperlyConfigured, 'Middleware module "%s" does not define a "%s" class' % (mw_module, mw_classname)
|
raise exceptions.ImproperlyConfigured, 'Middleware module "%s" does not define a "%s" class' % (mw_module, mw_classname)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mw_instance = mw_class()
|
mw_instance = mw_class()
|
||||||
|
|
Loading…
Reference in New Issue