summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/core/urlresolvers.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/django/core/urlresolvers.py b/django/core/urlresolvers.py
index 2a0dda38b8..95cc914676 100644
--- a/django/core/urlresolvers.py
+++ b/django/core/urlresolvers.py
@@ -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)