Kaydet (Commit) 08a494c4 authored tarafından Adrian Holovaty's avatar Adrian Holovaty

Added better error handling for trailing periods in URLconf include()s

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1376 bcc190cf-cafb-0310-a4f2-bffc1f526a37
üst fce688cc
......@@ -7,7 +7,7 @@ a string) and returns a tuple in this format:
(view_function, dict_of_view_function_args)
"""
from django.core.exceptions import Http404, ViewDoesNotExist
from django.core.exceptions import Http404, ImproperlyConfigured, ViewDoesNotExist
import re
class Resolver404(Http404):
......@@ -74,7 +74,11 @@ class RegexURLResolver(object):
try:
return self._urlconf_module
except AttributeError:
self._urlconf_module = __import__(self.urlconf_name, '', '', [''])
try:
self._urlconf_module = __import__(self.urlconf_name, '', '', [''])
except ValueError, e:
# Invalid urlconf_name, such as "foo.bar." (note trailing period)
raise ImproperlyConfigured, "Error while importing URLconf %r: %s" % (self.urlconf_name, e)
return self._urlconf_module
urlconf_module = property(_get_urlconf_module)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment