mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
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
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user