#15144: Max age set in cache control no longer obeys timeout set with
@cache_page
decorator
--------------------------+-------------------------------------------------
Reporter: jsdalton | Owner: nobody
Status: new | Milestone: 1.3
Component: Cache system | Version: SVN
Keywords: | Stage: Unreviewed
Has_patch: 0 |
--------------------------+-------------------------------------------------
Per the documentation, I would expect the max-age value set in the Cache
Control to obey the timeout value passed to `@cache_page` when that
decorator is used in a view. However, at present the max_age ignores that
setting and instead uses the default timeout from the cache. (As a matter
of fact, it even ignores the CACHE_MIDDLEWARE_SECONDS settings.)
I believe this is a regression, which from what I can tell, appears to
have arisen in [15021]. This changeset introduced the following changes:
The following line, which originally set the value of `self.cache_timeout`
at the start of `CacheMiddleware.__init__` to `cache_timeout`, was
removed:
{{{
self.cache_timeout = cache_timeout
}}}
The following line was added to `CacheMiddleware.__init__`:
{{{
self.cache_timeout = self.cache.default_timeout
}}}
The result is that max_age is set to the value of whatever the cache
timeout setting of the cache used, rather than the value of
`cache_timeout` passed into `__init__()`as it did formerly.
I wasn't able to find any background on this changeset so I couldn't
determine whether this was a purposeful change in behavior for some other
reason. For now, though, I can only conclude that this is a bug, since I
would expect max-age to match the value of the timeout passed to
cache_page.
--
Ticket URL: <http://code.djangoproject.com/ticket/15144>
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.