summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-08-14 14:27:35 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-08-14 14:27:35 +0000
commit859fc020a7c5ce30784d6388858ffbc613ef6612 (patch)
tree699e6e0c92df210536a5299562d54d432fa8b374 /django
parent7e52bb2bc3ea6b3c32866d948268c8681c3e12b3 (diff)
Fixed #5350 -- Added fallback to default 404/500 handlers when they're not explicitly specified (or imported) in a urls.py file. Thanks to Thomas Güttler for the report and initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13590 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/core/urlresolvers.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/django/core/urlresolvers.py b/django/core/urlresolvers.py
index 6881bbda9f..2d999d0de7 100644
--- a/django/core/urlresolvers.py
+++ b/django/core/urlresolvers.py
@@ -284,7 +284,12 @@ class RegexURLResolver(object):
url_patterns = property(_get_url_patterns)
def _resolve_special(self, view_type):
- callback = getattr(self.urlconf_module, 'handler%s' % view_type)
+ callback = getattr(self.urlconf_module, 'handler%s' % view_type, None)
+ if not callback:
+ # No handler specified in file; use default
+ # Lazy import, since urls.defaults imports this file
+ from django.conf.urls import defaults
+ callback = getattr(defaults, 'handler%s' % view_type)
try:
return get_callable(callback), {}
except (ImportError, AttributeError), e: