From 807226cd79dbe61a8b3ba9fdfae865c5685f0b42 Mon Sep 17 00:00:00 2001 From: BeryCZ Date: Wed, 24 Feb 2021 21:32:37 +0100 Subject: [PATCH] Fixed #32480 -- Corrected docstring and removed redundant comments in django/views/defaults.py. --- django/views/defaults.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/django/views/defaults.py b/django/views/defaults.py index 2fb0d0b38c..e3d2c3dd29 100644 --- a/django/views/defaults.py +++ b/django/views/defaults.py @@ -24,9 +24,11 @@ ERROR_PAGE_TEMPLATE = """ """ -# This can be called when CsrfViewMiddleware.process_view has not run, +# These views can be called when CsrfViewMiddleware.process_view() not run, # therefore need @requires_csrf_token in case the template needs # {% csrf_token %}. + + @requires_csrf_token def page_not_found(request, exception, template_name=ERROR_404_TEMPLATE_NAME): """ @@ -119,16 +121,16 @@ def bad_request(request, exception, template_name=ERROR_400_TEMPLATE_NAME): return HttpResponseBadRequest(template.render()) -# This can be called when CsrfViewMiddleware.process_view has not run, -# therefore need @requires_csrf_token in case the template needs -# {% csrf_token %}. @requires_csrf_token def permission_denied(request, exception, template_name=ERROR_403_TEMPLATE_NAME): """ Permission denied (403) handler. Templates: :template:`403.html` - Context: None + Context: + exception + The message from the exception which triggered the 403 (if one was + supplied). If the template does not exist, an Http403 response containing the text "403 Forbidden" (as per RFC 7231) will be returned.