#15260: CACHE_MIDDLEWARE_ANONYMOUS_ONLY doesn't do anything when used with
@cache_page in Django 1.2.5
---------------------------------+------------------------------------------
Reporter: brodie | Owner: nobody
Status: new | Milestone:
Component: Cache system | Version: 1.2
Keywords: session vary cookie | Triage Stage: Unreviewed
Has patch: 0 |
---------------------------------+------------------------------------------
As of [15382], setting CACHE_MIDDLEWARE_ANONYMOUS_ONLY to True and using
@cache_page on a view will unconditionally cache the view's response, even
for logged in users, and even when request.user is accessed.
For example:
{{{
#!python
@cache_page(60 * 15)
def view(request):
request.user
return HttpResponse('')
}}}
The response will be cached unconditionally, even for logged in requests.
The headers will look like this:
{{{
#!python
[('Expires', 'Thu, 10 Feb 2011 02:53:28 GMT'),
('Vary', 'Cookie'),
('Last-Modified', 'Thu, 10 Feb 2011 02:38:28 GMT'),
('ETag', '"ee11cbb19052e40b07aac0ca060c23ee"'),
('Cache-Control', 'max-age=900'),
('Content-Type', 'text/html; charset=utf-8')]
}}}
Setting the decorators to @vary_on_cookie and then @cache_page results in
the same thing. Flipping the order and setting them to @cache_page
followed by @vary_on_cookie results in the correct behavior (no caching).
Also, the release notes for 1.2.5 make no mention of the changes
introduced by [15382].
--
Ticket URL: <http://code.djangoproject.com/ticket/15260>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.