Ticket #5557: django-utils-cache-py.patch
File django-utils-cache-py.patch, 1.8 KB (added by , 17 years ago) |
---|
-
cache.py
23 23 from email.Utils import formatdate 24 24 from django.conf import settings 25 25 from django.core.cache import cache 26 from django.utils.encoding import smart_str 26 from django.utils.encoding import smart_str, iri_to_uri 27 27 28 28 cc_delim_re = re.compile(r'\s*,\s*') 29 29 … … 118 118 value = request.META.get(header, None) 119 119 if value is not None: 120 120 ctx.update(value) 121 return 'views.decorators.cache.cache_page.%s.%s.%s' % (key_prefix, request.path, ctx.hexdigest())121 return 'views.decorators.cache.cache_page.%s.%s.%s' % (key_prefix, iri_to_uri(request.path), ctx.hexdigest()) 122 122 123 123 def get_cache_key(request, key_prefix=None): 124 124 """ … … 132 132 """ 133 133 if key_prefix is None: 134 134 key_prefix = settings.CACHE_MIDDLEWARE_KEY_PREFIX 135 cache_key = 'views.decorators.cache.cache_header.%s.%s' % (key_prefix, request.path)135 cache_key = 'views.decorators.cache.cache_header.%s.%s' % (key_prefix, iri_to_uri(request.path)) 136 136 headerlist = cache.get(cache_key, None) 137 137 if headerlist is not None: 138 138 return _generate_cache_key(request, headerlist, key_prefix) … … 156 156 key_prefix = settings.CACHE_MIDDLEWARE_KEY_PREFIX 157 157 if cache_timeout is None: 158 158 cache_timeout = settings.CACHE_MIDDLEWARE_SECONDS 159 cache_key = 'views.decorators.cache.cache_header.%s.%s' % (key_prefix, request.path)159 cache_key = 'views.decorators.cache.cache_header.%s.%s' % (key_prefix, iri_to_uri(request.path)) 160 160 if response.has_header('Vary'): 161 161 headerlist = ['HTTP_'+header.upper().replace('-', '_') for header in vary_delim_re.split(response['Vary'])] 162 162 cache.set(cache_key, headerlist, cache_timeout)