summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeryCZ <martin-beran@seznam.cz>2021-02-24 21:32:37 +0100
committerGitHub <noreply@github.com>2021-02-24 21:32:37 +0100
commit807226cd79dbe61a8b3ba9fdfae865c5685f0b42 (patch)
treea5fea9086ffd24e72fd7ec878cc70163b20b62db
parent3089018e951dcca568574c0e0ebf9d8aab112389 (diff)
Fixed #32480 -- Corrected docstring and removed redundant comments in django/views/defaults.py.
-rw-r--r--django/views/defaults.py12
1 files 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.