if hasattr(request, 'session'):
request.session['django_language'] = lang
else:
response.set_cookie(settings.LANGUAGE_COOKIE_NAME, lang)
Salvatore Iovene writes:
Strange. I had the very same problem, but I identified the
browser's internal caching heuristics as the problem. If there are
no explicit caching headers in the response, the browser guesses.
Sending e.g. "Expires: ..." so that the page expires immediately
solved the problem.
(By the way, I didn't send those headers eventually. The browser's
heuristics make the site faster in other cases, and users switch
language only seldomly.)
Tsch�,
Torsten.
--
Torsten Bronger Jabber ID: torsten...@jabber.rwth-aachen.de
or http://bronger-jmp.appspot.com
Sending an Expires header so that the page expires immediately does
work, but it feels like fixing a headache with a guillotine. The
browser should cache it's own version whenever possible, even though
we're caching server side with memcached.
--
Salvatore Iovene
http://www.google.com/profiles/salvatore.iovene
Salvatore Iovene writes:
> On Sat, Nov 5, 2011 at 7:43 AM, Torsten Bronger
> <bro...@physik.rwth-aachen.de> wrote:
>
>> Sending e.g. "Expires: ..." so that the page expires immediately
>> solved the problem.
>
> Sending an Expires header so that the page expires immediately
> does work, but it feels like fixing a headache with a
> guillotine. The browser should cache it's own version whenever
> possible, even though we're caching server side with memcached.
See
<http://www-archive.mozilla.org/projects/netlib/http/http-caching-faq.html>.
Other browsers have similar rules. If you don't tell the browser
explicitly not to cache the page, it might just do this -- and so
won't ask the server. Then, re-coding your web app won't help.