Refs #32956 -- Changed docs to treat the acronym HTTP phonetically.

This commit is contained in:
David Smith 2021-10-18 17:06:00 +01:00 committed by Mariusz Felisiak
parent e2f778d579
commit 69b0736fad
13 changed files with 22 additions and 18 deletions

View File

@ -176,7 +176,7 @@ class ASGIHandler(base.BaseHandler):
await self.send_response(response, send) await self.send_response(response, send)
async def read_body(self, receive): async def read_body(self, receive):
"""Reads a HTTP body from an ASGI connection.""" """Reads an HTTP body from an ASGI connection."""
# Use the tempfile that auto rolls-over to a disk file as it fills up. # Use the tempfile that auto rolls-over to a disk file as it fills up.
body_file = tempfile.SpooledTemporaryFile(max_size=settings.FILE_UPLOAD_MAX_MEMORY_SIZE, mode='w+b') body_file = tempfile.SpooledTemporaryFile(max_size=settings.FILE_UPLOAD_MAX_MEMORY_SIZE, mode='w+b')
while True: while True:

View File

@ -13,7 +13,7 @@ from django.utils.functional import Promise
def render(request, template_name, context=None, content_type=None, status=None, using=None): def render(request, template_name, context=None, content_type=None, status=None, using=None):
""" """
Return a HttpResponse whose content is filled with the result of calling Return an HttpResponse whose content is filled with the result of calling
django.template.loader.render_to_string() with the passed arguments. django.template.loader.render_to_string() with the passed arguments.
""" """
content = loader.render_to_string(template_name, context, request, using=using) content = loader.render_to_string(template_name, context, request, using=using)
@ -56,7 +56,7 @@ def _get_queryset(klass):
def get_object_or_404(klass, *args, **kwargs): def get_object_or_404(klass, *args, **kwargs):
""" """
Use get() to return an object, or raise a Http404 exception if the object Use get() to return an object, or raise an Http404 exception if the object
does not exist. does not exist.
klass may be a Model, Manager, or QuerySet object. All other passed klass may be a Model, Manager, or QuerySet object. All other passed
@ -80,7 +80,7 @@ def get_object_or_404(klass, *args, **kwargs):
def get_list_or_404(klass, *args, **kwargs): def get_list_or_404(klass, *args, **kwargs):
""" """
Use filter() to return a list of objects, or raise a Http404 exception if Use filter() to return a list of objects, or raise an Http404 exception if
the list is empty. the list is empty.
klass may be a Model, Manager, or QuerySet object. All other passed klass may be a Model, Manager, or QuerySet object. All other passed

View File

@ -117,7 +117,7 @@ def conditional_content_removal(request, response):
class ClientHandler(BaseHandler): class ClientHandler(BaseHandler):
""" """
A HTTP Handler that can be used for testing purposes. Use the WSGI An HTTP Handler that can be used for testing purposes. Use the WSGI
interface to compose requests, but return the raw HttpResponse object with interface to compose requests, but return the raw HttpResponse object with
the originating WSGIRequest attached to its ``wsgi_request`` attribute. the originating WSGIRequest attached to its ``wsgi_request`` attribute.
""" """

View File

@ -146,6 +146,9 @@ documentation:
* **email** -- no hyphen. * **email** -- no hyphen.
* **HTTP** -- the expected pronunciation is "Aitch Tee Tee Pee" and therefore
should be preceded by "an" and not "a".
* **MySQL**, **PostgreSQL**, **SQLite** * **MySQL**, **PostgreSQL**, **SQLite**
* **SQL** -- when referring to SQL, the expected pronunciation should be * **SQL** -- when referring to SQL, the expected pronunciation should be

View File

@ -86,7 +86,7 @@ MRO is an acronym for Method Resolution Order.
.. method:: dispatch(request, *args, **kwargs) .. method:: dispatch(request, *args, **kwargs)
The ``view`` part of the view -- the method that accepts a ``request`` The ``view`` part of the view -- the method that accepts a ``request``
argument plus arguments, and returns a HTTP response. argument plus arguments, and returns an HTTP response.
The default implementation will inspect the HTTP method and attempt to The default implementation will inspect the HTTP method and attempt to
delegate to a method that matches the HTTP method; a ``GET`` will be delegate to a method that matches the HTTP method; a ``GET`` will be
@ -99,7 +99,7 @@ MRO is an acronym for Method Resolution Order.
.. method:: http_method_not_allowed(request, *args, **kwargs) .. method:: http_method_not_allowed(request, *args, **kwargs)
If the view was called with a HTTP method it doesn't support, this If the view was called with an HTTP method it doesn't support, this
method is called instead. method is called instead.
The default implementation returns ``HttpResponseNotAllowed`` with a The default implementation returns ``HttpResponseNotAllowed`` with a

View File

@ -177,7 +177,7 @@ list of errors.
.. exception:: RequestAborted .. exception:: RequestAborted
The :exc:`RequestAborted` exception is raised when a HTTP body being read The :exc:`RequestAborted` exception is raised when an HTTP body being read
in by the handler is cut off midstream and the client connection closes, in by the handler is cut off midstream and the client connection closes,
or when the client does not send data and hits a timeout where the server or when the client does not send data and hits a timeout where the server
closes the connection. closes the connection.

View File

@ -2343,7 +2343,7 @@ already have it.
Default: ``None`` Default: ``None``
A tuple representing a HTTP header/value combination that signifies a request A tuple representing an HTTP header/value combination that signifies a request
is secure. This controls the behavior of the request object's ``is_secure()`` is secure. This controls the behavior of the request object's ``is_secure()``
method. method.

View File

@ -81,7 +81,7 @@ Django 1.3 adds framework-level support for Python's ``logging``
module. This means you can now easily configure and control logging module. This means you can now easily configure and control logging
as part of your Django project. A number of logging handlers and as part of your Django project. A number of logging handlers and
logging calls have been added to Django's own code as well -- most logging calls have been added to Django's own code as well -- most
notably, the error emails sent on a HTTP 500 server error are now notably, the error emails sent on an HTTP 500 server error are now
handled as a logging activity. See :doc:`the documentation on Django's handled as a logging activity. See :doc:`the documentation on Django's
logging interface </topics/logging>` for more details. logging interface </topics/logging>` for more details.

View File

@ -653,7 +653,7 @@ same behavior -- except for the format of the response.
If you want to be really adventurous, you could even mix a If you want to be really adventurous, you could even mix a
:class:`~django.views.generic.detail.DetailView` subclass that is able :class:`~django.views.generic.detail.DetailView` subclass that is able
to return *both* HTML and JSON content, depending on some property of to return *both* HTML and JSON content, depending on some property of
the HTTP request, such as a query argument or a HTTP header. Mix in both the the HTTP request, such as a query argument or an HTTP header. Mix in both the
``JSONResponseMixin`` and a ``JSONResponseMixin`` and a
:class:`~django.views.generic.detail.SingleObjectTemplateResponseMixin`, :class:`~django.views.generic.detail.SingleObjectTemplateResponseMixin`,
and override the implementation of and override the implementation of

View File

@ -717,7 +717,7 @@ A subclass of :class:`unittest.TestCase` that adds this functionality:
* Verifying that a template :meth:`has/hasn't been used to generate a given * Verifying that a template :meth:`has/hasn't been used to generate a given
response content <SimpleTestCase.assertTemplateUsed>`. response content <SimpleTestCase.assertTemplateUsed>`.
* Verifying that two :meth:`URLs <SimpleTestCase.assertURLEqual>` are equal. * Verifying that two :meth:`URLs <SimpleTestCase.assertURLEqual>` are equal.
* Verifying a HTTP :meth:`redirect <SimpleTestCase.assertRedirects>` is * Verifying an HTTP :meth:`redirect <SimpleTestCase.assertRedirects>` is
performed by the app. performed by the app.
* Robustly testing two :meth:`HTML fragments <SimpleTestCase.assertHTMLEqual>` * Robustly testing two :meth:`HTML fragments <SimpleTestCase.assertHTMLEqual>`
for equality/inequality or :meth:`containment <SimpleTestCase.assertInHTML>`. for equality/inequality or :meth:`containment <SimpleTestCase.assertInHTML>`.

View File

@ -89,7 +89,8 @@ class ViewTest(SimpleTestCase):
def test_pathological_http_method(self): def test_pathological_http_method(self):
""" """
The edge case of a http request that spoofs an existing method name is caught. The edge case of an http request that spoofs an existing method name is
caught.
""" """
self.assertEqual(SimpleView.as_view()( self.assertEqual(SimpleView.as_view()(
self.rf.get('/', REQUEST_METHOD='DISPATCH') self.rf.get('/', REQUEST_METHOD='DISPATCH')
@ -140,7 +141,7 @@ class ViewTest(SimpleTestCase):
def test_invalid_keyword_argument(self): def test_invalid_keyword_argument(self):
""" """
View arguments must be predefined on the class and can't View arguments must be predefined on the class and can't
be named like a HTTP method. be named like an HTTP method.
""" """
msg = ( msg = (
'The method name %s is not accepted as a keyword argument to ' 'The method name %s is not accepted as a keyword argument to '

View File

@ -10,7 +10,7 @@ class GetObjectOr404Tests(TestCase):
a1 = Author.objects.create(name="Brave Sir Robin") a1 = Author.objects.create(name="Brave Sir Robin")
a2 = Author.objects.create(name="Patsy") a2 = Author.objects.create(name="Patsy")
# No Articles yet, so we should get a Http404 error. # No Articles yet, so we should get an Http404 error.
with self.assertRaises(Http404): with self.assertRaises(Http404):
get_object_or_404(Article, title="Foo") get_object_or_404(Article, title="Foo")
@ -28,7 +28,7 @@ class GetObjectOr404Tests(TestCase):
article article
) )
# No articles containing "Camelot". This should raise a Http404 error. # No articles containing "Camelot". This should raise an Http404 error.
with self.assertRaises(Http404): with self.assertRaises(Http404):
get_object_or_404(a1.article_set, title__contains="Camelot") get_object_or_404(a1.article_set, title__contains="Camelot")
@ -50,7 +50,7 @@ class GetObjectOr404Tests(TestCase):
with self.assertRaises(Author.MultipleObjectsReturned): with self.assertRaises(Author.MultipleObjectsReturned):
get_object_or_404(Author.objects.all()) get_object_or_404(Author.objects.all())
# Using an empty QuerySet raises a Http404 error. # Using an empty QuerySet raises an Http404 error.
with self.assertRaises(Http404): with self.assertRaises(Http404):
get_object_or_404(Article.objects.none(), title__contains="Run") get_object_or_404(Article.objects.none(), title__contains="Run")

View File

@ -173,7 +173,7 @@ class LiveServerViews(LiveServerBase):
def test_closes_connection_without_content_length(self): def test_closes_connection_without_content_length(self):
""" """
A HTTP 1.1 server is supposed to support keep-alive. Since our An HTTP 1.1 server is supposed to support keep-alive. Since our
development server is rather simple we support it only in cases where development server is rather simple we support it only in cases where
we can detect a content length from the response. This should be doable we can detect a content length from the response. This should be doable
for all simple views and streaming responses where an iterable with for all simple views and streaming responses where an iterable with