Opened 15 years ago
Closed 4 years ago
#12794 closed Bug (invalid)
Interaction between sessions and django.views.i18n.set_language causes caching errors
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Internationalization | Version: | 1.1 |
Severity: | Normal | Keywords: | cache i18n |
Cc: | alessandro.guido+bugzilla@…, raymond.penners@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
The django.views.i18n.set_language view uses the session to store the language if it is available.
If a user has a session and tries to change the language, this change is reflected only in the variables inside the session storage. Since the headers of following requests won't change, the caching framework cannot detect such change and cached pages in the previous language will be returned.
I suggest always using cookies to store language.
Attachments (1)
Change History (13)
comment:1 by , 15 years ago
Cc: | added |
---|
comment:2 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 14 years ago
Type: | → Bug |
---|
comment:4 by , 14 years ago
Severity: | → Normal |
---|
comment:5 by , 14 years ago
Easy pickings: | unset |
---|
comment:6 by , 14 years ago
Cc: | added |
---|
comment:7 by , 14 years ago
For those interested, you can use the following Django app to have the language stored in a cookie as suggested.
comment:8 by , 13 years ago
Has patch: | set |
---|---|
UI/UX: | unset |
I have attached a patch that stops Django from storing the language in the session.
A decision is needed on whether support for storing the language in the session is to be completely dropped, or whether it is to be made configurable via settings. For now, the old behaviour has been put below an "if False:" so that it can be easily reinstantiated.
comment:9 by , 13 years ago
#16461 was a duplicate, reported similar problems but with browsers caches.
comment:10 by , 12 years ago
Needs documentation: | set |
---|---|
Patch needs improvement: | set |
comment:11 by , 12 years ago
comment:12 by , 4 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
set_language()
doesn't store user's language in the session anymore, see d134b0b93ee10a2128c595997cbc6022c4a982f7.
See also #15902