Because cache_page do a pickle caching, we have a 3.1 JsonResponse running
on 3.2, without the new headers feature.
{{{
AttributeError: 'JsonResponse' object has no attribute 'headers'
File "django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "commons/middleware.py", line 44, in __call__
response['X-Current-Version'] = VERSION
File "django/http/response.py", line 172, in __setitem__
self.headers[header] = value
}}}
Docs could provide some help about this, the fix should be easy cleaning
specific cache or using `CACHE_MIDDLEWARE_KEY_PREFIX`. that is
unfortunately broken.
https://code.djangoproject.com/ticket/32841
--
Ticket URL: <https://code.djangoproject.com/ticket/32844>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => wontfix
* component: Uncategorized => Documentation
* type: Uncategorized => Bug
Comment:
Hi.
> ...we have a 3.1 JsonResponse running on 3.2...
I can't see how that's ever going to be supported. The response API
doesn't change often but if it does you'll have to clear the cache. You
note this:
> ...fix should be easy cleaning specific cache...
This seems a bit particular to merit specific documentation.
--
Ticket URL: <https://code.djangoproject.com/ticket/32844#comment:1>
Comment (by Simon Charette):
FWIW we've used the `KEY_FUNCTION`
[https://docs.djangoproject.com/en/3.2/ref/settings/#std:setting-CACHES-
KEY_FUNCTION setting] to namespace keys of `CACHES` entries doing rich
object serde by Django major version to prevent these issues from
happening. You have to be careful to do a progressive rollout to prevent
cache miss stampedes but it completely avoids these kinds of issues.
--
Ticket URL: <https://code.djangoproject.com/ticket/32844#comment:2>
Comment (by Iuri de Silvio):
I didn't knew about this `KEY_FUNCTION`.
It would be a problem in my case because we have other keys in the same
cache, but not difficult to move to a different cache and use that.
Thanks!
--
Ticket URL: <https://code.djangoproject.com/ticket/32844#comment:3>