Code

Ticket #18191: ignore_accept_language.diff

File ignore_accept_language.diff, 851 bytes (added by choongmin@…, 2 years ago)
Line 
1Index: django/utils/cache.py
2===================================================================
3--- django/utils/cache.py       (revision 17929)
4+++ django/utils/cache.py       (working copy)
5@@ -234,8 +234,11 @@
6     if cache is None:
7         cache = get_cache(settings.CACHE_MIDDLEWARE_ALIAS)
8     if response.has_header('Vary'):
9-        headerlist = ['HTTP_'+header.upper().replace('-', '_')
10-                      for header in cc_delim_re.split(response['Vary'])]
11+        headerlist = []
12+        for header in cc_delim_re.split(response['Vary']):
13+            header = header.upper().replace('-', '_')
14+            if header != 'ACCEPT_LANGUAGE':
15+                headerlist.append('HTTP_' + header)
16         cache.set(cache_key, headerlist, cache_timeout)
17         return _generate_cache_key(request, request.method, headerlist, key_prefix)
18     else: