Skip to content

Commit

Permalink
Refs #30400 -- Improved typography in debug and csrf templates.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdufresne authored and felixxm committed Jul 8, 2020
1 parent 779e615 commit 0e6fa65
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions django/views/csrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@
<p>In general, this can occur when there is a genuine Cross Site Request Forgery, or when
<a
href="https://docs.djangoproject.com/en/{{ docs_version }}/ref/csrf/">Django's
href="https://docs.djangoproject.com/en/{{ docs_version }}/ref/csrf/">Djangos
CSRF mechanism</a> has not been used correctly. For POST forms, you need to
ensure:</p>
<ul>
<li>Your browser is accepting cookies.</li>
<li>The view function passes a <code>request</code> to the template's <a
<li>The view function passes a <code>request</code> to the templates <a
href="https://docs.djangoproject.com/en/dev/topics/templates/#django.template.backends.base.Template.render"><code>render</code></a>
method.</li>
Expand All @@ -84,7 +84,7 @@
page with the form, because the token is rotated after a login.</li>
</ul>
<p>You're seeing the help section of this page because you have <code>DEBUG =
<p>Youre seeing the help section of this page because you have <code>DEBUG =
True</code> in your Django settings file. Change that to <code>False</code>,
and only the initial error message will be displayed. </p>
Expand Down
4 changes: 2 additions & 2 deletions django/views/templates/technical_404.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ <h1>Page not found <span>(404)</span></h1>
<p>
{% if request_path %}
The current path, <code>{{ request_path }}</code>,{% else %}
The empty path{% endif %} didn't match any of these.
The empty path{% endif %} didnt match any of these.
</p>
{% else %}
<p>{{ reason }}</p>
Expand All @@ -70,7 +70,7 @@ <h1>Page not found <span>(404)</span></h1>

<div id="explanation">
<p>
You're seeing this error because you have <code>DEBUG = True</code> in
Youre seeing this error because you have <code>DEBUG = True</code> in
your Django settings file. Change that to <code>False</code>, and Django
will display a standard 404 page.
</p>
Expand Down
2 changes: 1 addition & 1 deletion django/views/templates/technical_500.html
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ <h4>Using settings module <code>{{ settings.SETTINGS_MODULE }}</code></h4>
{% if not is_email %}
<div id="explanation">
<p>
You're seeing this error because you have <code>DEBUG = True</code> in your
Youre seeing this error because you have <code>DEBUG = True</code> in your
Django settings file. Change that to <code>False</code>, and Django will
display a standard page generated by the handler for this status code.
</p>
Expand Down
2 changes: 1 addition & 1 deletion django/views/templates/technical_500.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Using settings module {{ settings.SETTINGS_MODULE }}{% for k, v in settings.item
{{ k }} = {{ v|stringformat:"r" }}{% endfor %}

{% if not is_email %}
You're seeing this error because you have DEBUG = True in your
Youre seeing this error because you have DEBUG = True in your
Django settings file. Change that to False, and Django will
display a standard page generated by the handler for this status code.
{% endif %}
6 changes: 3 additions & 3 deletions tests/view_tests/tests/test_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ def test_403_template(self):
def test_404(self):
response = self.client.get('/raises404/')
self.assertEqual(response.status_code, 404)
self.assertContains(response, "<code>not-in-urls</code>, didn't match", status_code=404)
self.assertContains(response, '<code>not-in-urls</code>, didnt match', status_code=404)

def test_404_not_in_urls(self):
response = self.client.get('/not-in-urls')
self.assertNotContains(response, "Raised by:", status_code=404)
self.assertContains(response, "Django tried these URL patterns", status_code=404)
self.assertContains(response, "<code>not-in-urls</code>, didn't match", status_code=404)
self.assertContains(response, '<code>not-in-urls</code>, didnt match', status_code=404)
# Pattern and view name of a RegexURLPattern appear.
self.assertContains(response, r"^regex-post/(?P&lt;pk&gt;[0-9]+)/$", status_code=404)
self.assertContains(response, "[name='regex-post']", status_code=404)
Expand All @@ -130,7 +130,7 @@ def test_404_not_in_urls(self):
@override_settings(ROOT_URLCONF=WithoutEmptyPathUrls)
def test_404_empty_path_not_in_urls(self):
response = self.client.get('/')
self.assertContains(response, "The empty path didn't match any of these.", status_code=404)
self.assertContains(response, 'The empty path didnt match any of these.', status_code=404)

def test_technical_404(self):
response = self.client.get('/technical404/')
Expand Down

0 comments on commit 0e6fa65

Please sign in to comment.