mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +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:
@@ -356,6 +356,22 @@ class ErrorHandlerResolutionTests(TestCase):
|
||||
self.assertEqual(self.callable_resolver.resolve404(), handler)
|
||||
self.assertEqual(self.callable_resolver.resolve500(), handler)
|
||||
|
||||
class DefaultErrorHandlerTests(TestCase):
|
||||
urls = 'regressiontests.urlpatterns_reverse.urls_without_full_import'
|
||||
|
||||
def test_default_handler(self):
|
||||
"If the urls.py doesn't specify handlers, the defaults are used"
|
||||
try:
|
||||
response = self.client.get('/test/')
|
||||
self.assertEquals(response.status_code, 404)
|
||||
except AttributeError:
|
||||
self.fail("Shouldn't get an AttributeError due to undefined 404 handler")
|
||||
|
||||
try:
|
||||
self.assertRaises(ValueError, self.client.get, '/bad_view/')
|
||||
except AttributeError:
|
||||
self.fail("Shouldn't get an AttributeError due to undefined 500 handler")
|
||||
|
||||
class NoRootUrlConfTests(TestCase):
|
||||
"""Tests for handler404 and handler500 if urlconf is None"""
|
||||
urls = None
|
||||
|
||||
Reference in New Issue
Block a user