Fixed #32480 -- Corrected docstring and removed redundant comments in django/views/defaults.py.

This commit is contained in:
BeryCZ 2021-02-24 21:32:37 +01:00 committed by GitHub
parent 3089018e95
commit 807226cd79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -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.