Jeremy,

Thanks for your response. But, I am using the locale middleware from
Django itself. And it automatically updates the Vary header. See:
django/trunk/django/middleware/locale.py

def process_response(self, request, response):
       patch_vary_headers(response, ('Accept-Language',))
       response['Content-Language'] = translation.get_language()
       translation.deactivate()
       return response

And when I do inspect the header response from my application it indeed
looks like this:
Vary: Accept-Language,Cookie,Accept-Encoding

However you did make me think. You suggested that the Vary header
should include Content-Language. If I look at my response header the
Content-Language header looks like: Content-Language: nl and if I
switch to English it looks like: Content-Language: en. Obviously.

Perhaps there is a bug in locale.py. Should:

patch_vary_headers(response, ('Accept-Language',))

perhaps be:

patch_vary_headers(response, ('Content-Language',))

Could it be that simple? I will check. If this is indeed the solution I
will file a bug.

Berry

On 24 dec, 04:23, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
On 12/23/06, Beegee <[EMAIL PROTECTED]> wrote:

> But, whenever I switch between the two languages with caching enabled
> the results are unpredictable. I get a Dutch page when I should get an
> English one and vice versa.The cache middleware creates it's keys based on 
the initial response's
vary header.
You'll need to use vary_on_headers, presumably including 
Content-Language.http://www.djangoproject.com/documentation/cache/#using-vary-headers


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to