mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #14200 -- Added a fallback if HttpRequest.urlconf is None.
Made BaseHandler fall back to settings.ROOT_URLCONF if HttpRequest.urlconf is set to None, rather than raising ImproperlyConfigured.
This commit is contained in:
committed by
Tim Graham
parent
74402a5b0d
commit
738c0de300
@@ -700,7 +700,17 @@ class RequestURLconfTests(SimpleTestCase):
|
||||
]
|
||||
)
|
||||
def test_urlconf_overridden_with_null(self):
|
||||
self.assertRaises(ImproperlyConfigured, self.client.get, '/test/me/')
|
||||
"""
|
||||
Overriding request.urlconf with None will fall back to the default
|
||||
URLconf.
|
||||
"""
|
||||
response = self.client.get('/test/me/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.content, b'outer:/test/me/,inner:/inner_urlconf/second_test/')
|
||||
response = self.client.get('/inner_urlconf/second_test/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
response = self.client.get('/second_test/')
|
||||
self.assertEqual(response.status_code, 404)
|
||||
|
||||
@override_settings(
|
||||
MIDDLEWARE_CLASSES=[
|
||||
|
||||
Reference in New Issue
Block a user