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: alessandro.gudio+bugzilla@… 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)

cooki18n.patch (3.0 KB ) - added by Raymond Penners 13 years ago.
No longer store language in session

Download all attachments as: .zip

Change History (13)

comment:1 by anonymous, 15 years ago

Cc: alessandro.guido+bugzilla@… added

comment:2 by Russell Keith-Magee, 15 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Luke Plant, 14 years ago

Type: Bug

comment:4 by Luke Plant, 14 years ago

Severity: Normal

comment:5 by Luke Plant, 14 years ago

Easy pickings: unset

See also #15902

comment:6 by raymond.penners@…, 14 years ago

Cc: raymond.penners@… added

comment:7 by raymond.penners@…, 14 years ago

For those interested, you can use the following Django app to have the language stored in a cookie as suggested.

https://github.com/pennersr/django-cooki18n

by Raymond Penners, 13 years ago

Attachment: cooki18n.patch added

No longer store language in session

comment:8 by Raymond Penners, 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 Ramiro Morales, 13 years ago

#16461 was a duplicate, reported similar problems but with browsers caches.

comment:10 by Jannis Leidel, 12 years ago

Needs documentation: set
Patch needs improvement: set

comment:12 by Mariusz Felisiak, 4 years ago

Resolution: invalid
Status: newclosed

set_language() doesn't store user's language in the session anymore, see d134b0b93ee10a2128c595997cbc6022c4a982f7.

Note: See TracTickets for help on using tickets.
Back to Top