mirror of https://github.com/django/django.git
Fixed #879 -- Middleware loader now throws a better error for MIDDLEWARE_CLASSES value without a dot. Thanks, Noah Slater
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1355 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
5b662cdd86
commit
b58c820558
|
@ -17,7 +17,10 @@ class BaseHandler:
|
||||||
self._response_middleware = []
|
self._response_middleware = []
|
||||||
self._exception_middleware = []
|
self._exception_middleware = []
|
||||||
for middleware_path in settings.MIDDLEWARE_CLASSES:
|
for middleware_path in settings.MIDDLEWARE_CLASSES:
|
||||||
|
try:
|
||||||
dot = middleware_path.rindex('.')
|
dot = middleware_path.rindex('.')
|
||||||
|
except ValueError:
|
||||||
|
raise exceptions.ImproperlyConfigured, '%s isn\'t look like a middleware module' % middleware_path
|
||||||
mw_module, mw_classname = middleware_path[:dot], middleware_path[dot+1:]
|
mw_module, mw_classname = middleware_path[:dot], middleware_path[dot+1:]
|
||||||
try:
|
try:
|
||||||
mod = __import__(mw_module, '', '', [''])
|
mod = __import__(mw_module, '', '', [''])
|
||||||
|
|
Loading…
Reference in New Issue