#5789: Django LocaleMiddleware django_language should be _language
---------------------------------------------------+------------------------
Reporter: jdunck | Owner: stugots
Status: assigned | Component: Internationalization
Version: SVN | Resolution:
Keywords: session i18n backwards-incompatible | Stage: Accepted
Has_patch: 1 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
---------------------------------------------------+------------------------
Comment (by mtredinnick):
The goal here is only to change the name of the variable stored inside the
session dictionary to be consistent with other Django internal session
keys. It is '''not''' about changing the cookie name. So the first part of
the patch can be removed.
This does introduce an interesting backwards incompatibility. If a site
upgrades to this version of the code, their users will lose the session
language setting (since Django will start looking for a different key
name) and if the session language is different from their browser
preference, it will revert to the browser preference. It's a little
annoying, because we try to avoid breaking things for users.
For bonus points, does anybody want to come up with a little Python script
we can put on the backwards incompatible page in the wiki that will
upgrade all sessions in the database to use the new format: it should
unpack the session, moves the `django_language` key to `_language` and
then resaves the session,preferably without modifying the expiry time. I
guess this isn't a showstopper, since the number of people affected will
be small (usually the browser and the language preference match, but
conflicts like Catalan/Spanish do exist).
--
Ticket URL: <
http://code.djangoproject.com/ticket/5789#comment:5>