Просмотр исходного кода

Dropped message support from 404 error

Rafał Pitoń 11 лет назад
Родитель
Сommit
34db734789

+ 0 - 4
misago/templates/misago/front/404.html

@@ -1,6 +1,2 @@
 <h1>Misago Error 404</h1>
-{% if message %}
-<p>{{ message }}</p>
-{% else %}
 <p>Page not found.</p>
-{% endif %}

+ 2 - 2
misago/views/errorpages.py

@@ -13,8 +13,8 @@ def permission_denied(request, message=None):
     return _error_page(request, 403, message)
 
 
-def page_not_found(request, message=None):
-    return _error_page(request, 404, message)
+def page_not_found(request):
+    return _error_page(request, 404)
 
 
 """

+ 1 - 2
misago/views/exceptionhandler.py

@@ -19,8 +19,7 @@ def _get_exception_message(exception):
 
 
 def handle_http404_exception(request, exception):
-    return errorpages.page_not_found(request,
-                                     _get_exception_message(exception))
+    return errorpages.page_not_found(request)
 
 
 def handle_outdated_slug_exception(request, exception):

+ 1 - 4
misago/views/tests/test_exceptions.py

@@ -57,8 +57,7 @@ class GetExceptionHandlerTests(TestCase):
 
 class HandleHttp404ExceptionTests(TestCase):
     def setUp(self):
-        self.exception_message = "Text page could not be found"
-        self.exception = Http404(self.exception_message)
+        self.exception = Http404()
         self.request = RequestFactory().get('/')
 
     def test_get_handle_http404_exception(self):
@@ -68,14 +67,12 @@ class HandleHttp404ExceptionTests(TestCase):
             found_handler, exceptionhandler.handle_http404_exception)
 
         response = found_handler(self.request, self.exception)
-        self.assertIn(self.exception_message, response.content)
         self.assertEqual(response.status_code, 404)
 
     def test_handle_http404_exception(self):
         """handle_misago_exception handles Http404 exception correctly"""
         response = exceptionhandler.handle_misago_exception(
             self.request, self.exception)
-        self.assertIn(self.exception_message, response.content)
         self.assertEqual(response.status_code, 404)