Used :rfc: role in docs/topics/conditional-view-processing.txt.
This commit is contained in:
parent
8eb5693091
commit
f8bab4e0dc
|
@ -34,14 +34,12 @@ processing functions.
|
||||||
The ``condition`` decorator
|
The ``condition`` decorator
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
Sometimes (in fact, quite often) you can create functions to rapidly compute the ETag_
|
Sometimes (in fact, quite often) you can create functions to rapidly compute
|
||||||
value or the last-modified time for a resource, **without** needing to do all
|
the :rfc:`ETag <7232#section-2.3>` value or the last-modified time for a
|
||||||
the computations needed to construct the full view. Django can then use these
|
resource, **without** needing to do all the computations needed to construct
|
||||||
functions to provide an "early bailout" option for the view processing.
|
the full view. Django can then use these functions to provide an
|
||||||
Telling the client that the content has not been modified since the last
|
"early bailout" option for the view processing. Telling the client that the
|
||||||
request, perhaps.
|
content has not been modified since the last request, perhaps.
|
||||||
|
|
||||||
.. _ETag: https://tools.ietf.org/html/rfc7232#section-2.3
|
|
||||||
|
|
||||||
These two functions are passed as parameters to the
|
These two functions are passed as parameters to the
|
||||||
``django.views.decorators.http.condition`` decorator. This decorator uses
|
``django.views.decorators.http.condition`` decorator. This decorator uses
|
||||||
|
@ -60,7 +58,8 @@ order, as the view function they are helping to wrap. The function passed
|
||||||
``last_modified_func`` should return a standard datetime value specifying the
|
``last_modified_func`` should return a standard datetime value specifying the
|
||||||
last time the resource was modified, or ``None`` if the resource doesn't
|
last time the resource was modified, or ``None`` if the resource doesn't
|
||||||
exist. The function passed to the ``etag`` decorator should return a string
|
exist. The function passed to the ``etag`` decorator should return a string
|
||||||
representing the `ETag`_ for the resource, or ``None`` if it doesn't exist.
|
representing the :rfc:`ETag <7232#section-2.3>` for the resource, or ``None``
|
||||||
|
if it doesn't exist.
|
||||||
|
|
||||||
The decorator sets the ``ETag`` and ``Last-Modified`` headers on the response
|
The decorator sets the ``ETag`` and ``Last-Modified`` headers on the response
|
||||||
if they are not already set by the view and if the request's method is safe
|
if they are not already set by the view and if the request's method is safe
|
||||||
|
|
Loading…
Reference in New Issue