[4.0.x] Refs #32956 -- Changed docs to treat the acronym HTTP phonetically.
Backport of 69b0736fad
from main
This commit is contained in:
parent
c067a2b68f
commit
6aa917383f
|
@ -176,7 +176,7 @@ class ASGIHandler(base.BaseHandler):
|
|||
await self.send_response(response, send)
|
||||
|
||||
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.
|
||||
body_file = tempfile.SpooledTemporaryFile(max_size=settings.FILE_UPLOAD_MAX_MEMORY_SIZE, mode='w+b')
|
||||
while True:
|
||||
|
|
|
@ -13,7 +13,7 @@ from django.utils.functional import Promise
|
|||
|
||||
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.
|
||||
"""
|
||||
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):
|
||||
"""
|
||||
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.
|
||||
|
||||
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):
|
||||
"""
|
||||
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.
|
||||
|
||||
klass may be a Model, Manager, or QuerySet object. All other passed
|
||||
|
|
|
@ -117,7 +117,7 @@ def conditional_content_removal(request, response):
|
|||
|
||||
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
|
||||
the originating WSGIRequest attached to its ``wsgi_request`` attribute.
|
||||
"""
|
||||
|
|
|
@ -146,6 +146,9 @@ documentation:
|
|||
|
||||
* **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**
|
||||
|
||||
* **SQL** -- when referring to SQL, the expected pronunciation should be
|
||||
|
|
|
@ -86,7 +86,7 @@ MRO is an acronym for Method Resolution Order.
|
|||
.. method:: dispatch(request, *args, **kwargs)
|
||||
|
||||
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
|
||||
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)
|
||||
|
||||
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.
|
||||
|
||||
The default implementation returns ``HttpResponseNotAllowed`` with a
|
||||
|
|
|
@ -179,7 +179,7 @@ list of errors.
|
|||
|
||||
.. 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,
|
||||
or when the client does not send data and hits a timeout where the server
|
||||
closes the connection.
|
||||
|
|
|
@ -2349,7 +2349,7 @@ already have it.
|
|||
|
||||
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()``
|
||||
method.
|
||||
|
||||
|
|
|
@ -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
|
||||
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
|
||||
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
|
||||
logging interface </topics/logging>` for more details.
|
||||
|
||||
|
|
|
@ -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
|
||||
:class:`~django.views.generic.detail.DetailView` subclass that is able
|
||||
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
|
||||
:class:`~django.views.generic.detail.SingleObjectTemplateResponseMixin`,
|
||||
and override the implementation of
|
||||
|
|
|
@ -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
|
||||
response content <SimpleTestCase.assertTemplateUsed>`.
|
||||
* 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.
|
||||
* Robustly testing two :meth:`HTML fragments <SimpleTestCase.assertHTMLEqual>`
|
||||
for equality/inequality or :meth:`containment <SimpleTestCase.assertInHTML>`.
|
||||
|
|
|
@ -89,7 +89,8 @@ class ViewTest(SimpleTestCase):
|
|||
|
||||
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.rf.get('/', REQUEST_METHOD='DISPATCH')
|
||||
|
@ -140,7 +141,7 @@ class ViewTest(SimpleTestCase):
|
|||
def test_invalid_keyword_argument(self):
|
||||
"""
|
||||
View arguments must be predefined on the class and can't
|
||||
be named like a HTTP method.
|
||||
be named like an HTTP method.
|
||||
"""
|
||||
msg = (
|
||||
'The method name %s is not accepted as a keyword argument to '
|
||||
|
|
|
@ -10,7 +10,7 @@ class GetObjectOr404Tests(TestCase):
|
|||
a1 = Author.objects.create(name="Brave Sir Robin")
|
||||
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):
|
||||
get_object_or_404(Article, title="Foo")
|
||||
|
||||
|
@ -28,7 +28,7 @@ class GetObjectOr404Tests(TestCase):
|
|||
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):
|
||||
get_object_or_404(a1.article_set, title__contains="Camelot")
|
||||
|
||||
|
@ -50,7 +50,7 @@ class GetObjectOr404Tests(TestCase):
|
|||
with self.assertRaises(Author.MultipleObjectsReturned):
|
||||
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):
|
||||
get_object_or_404(Article.objects.none(), title__contains="Run")
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ class LiveServerViews(LiveServerBase):
|
|||
|
||||
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
|
||||
we can detect a content length from the response. This should be doable
|
||||
for all simple views and streaming responses where an iterable with
|
||||
|
|
Loading…
Reference in New Issue