Kaydet (Commit) 9eb49af8 authored tarafından Kevin Christopher Henry's avatar Kevin Christopher Henry Kaydeden (comit) Tim Graham

Refs #19705 -- Documented decorator ordering with @condition().

üst 4cfccc71
...@@ -105,6 +105,18 @@ for your front page view:: ...@@ -105,6 +105,18 @@ for your front page view::
def front_page(request, blog_id): def front_page(request, blog_id):
... ...
.. admonition:: Be careful with the order of decorators
When ``condition()`` returns a conditional response, any decorators below
it will be skipped and won't apply to the response. Therefore, any
decorators that need to apply to both the regular view response and a
conditional response must be above ``condition()``. In particular,
:func:`~django.views.decorators.vary.vary_on_cookie`,
:func:`~django.views.decorators.vary.vary_on_headers`, and
:func:`~django.views.decorators.cache.cache_control` should come first
because :rfc:`RFC 7232 <7232#section-4.1>` requires that the headers they
set be present on 304 responses.
Shortcuts for only computing one value Shortcuts for only computing one value
====================================== ======================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment