mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Refs 32637 -- Made technical 404 debug page display exception message when URL is resolved.
Follow up to 3b8527e32b.
			
			
This commit is contained in:
		| @@ -26,7 +26,7 @@ | ||||
| <body> | ||||
|   <div id="summary"> | ||||
|     <h1>Page not found <span>(404)</span></h1> | ||||
|     {% if reason %}<pre class="exception_value">{{ reason }}</pre>{% endif %} | ||||
|     {% if reason and resolved %}<pre class="exception_value">{{ reason }}</pre>{% endif %} | ||||
|     <table class="meta"> | ||||
|       <tr> | ||||
|         <th>Request Method:</th> | ||||
|   | ||||
| @@ -122,6 +122,11 @@ class DebugViewTests(SimpleTestCase): | ||||
|  | ||||
|     def test_404(self): | ||||
|         response = self.client.get('/raises404/') | ||||
|         self.assertNotContains( | ||||
|             response, | ||||
|             '<pre class="exception_value">', | ||||
|             status_code=404, | ||||
|         ) | ||||
|         self.assertContains( | ||||
|             response, | ||||
|             '<p>The current path, <code>not-in-urls</code>, didn’t match any ' | ||||
| @@ -133,6 +138,11 @@ class DebugViewTests(SimpleTestCase): | ||||
|     def test_404_not_in_urls(self): | ||||
|         response = self.client.get('/not-in-urls') | ||||
|         self.assertNotContains(response, "Raised by:", status_code=404) | ||||
|         self.assertNotContains( | ||||
|             response, | ||||
|             '<pre class="exception_value">', | ||||
|             status_code=404, | ||||
|         ) | ||||
|         self.assertContains(response, "Django tried these URL patterns", status_code=404) | ||||
|         self.assertContains( | ||||
|             response, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user