diff --git a/AUTHORS b/AUTHORS index 665a3a666b..a6926b37b2 100644 --- a/AUTHORS +++ b/AUTHORS @@ -114,6 +114,7 @@ answer newbie questions, and generally made Django that much better: Enrico A. Murat Eren Ludvig Ericson + eriks@win.tue.nl Dirk Eschler Marc Fargas Szilveszter Farkas diff --git a/django/utils/cache.py b/django/utils/cache.py index 9cf436d798..f192e1115c 100644 --- a/django/utils/cache.py +++ b/django/utils/cache.py @@ -23,7 +23,7 @@ import time from email.Utils import formatdate from django.conf import settings from django.core.cache import cache -from django.utils.encoding import smart_str +from django.utils.encoding import smart_str, iri_to_uri cc_delim_re = re.compile(r'\s*,\s*') @@ -125,7 +125,7 @@ def _generate_cache_key(request, headerlist, key_prefix): value = request.META.get(header, None) if value is not None: ctx.update(value) - return 'views.decorators.cache.cache_page.%s.%s.%s' % (key_prefix, request.path, ctx.hexdigest()) + return 'views.decorators.cache.cache_page.%s.%s.%s' % (key_prefix, iri_to_uri(request.path), ctx.hexdigest()) def get_cache_key(request, key_prefix=None): """ @@ -139,7 +139,7 @@ def get_cache_key(request, key_prefix=None): """ if key_prefix is None: key_prefix = settings.CACHE_MIDDLEWARE_KEY_PREFIX - cache_key = 'views.decorators.cache.cache_header.%s.%s' % (key_prefix, request.path) + cache_key = 'views.decorators.cache.cache_header.%s.%s' % (key_prefix, iri_to_uri(request.path)) headerlist = cache.get(cache_key, None) if headerlist is not None: return _generate_cache_key(request, headerlist, key_prefix) @@ -163,7 +163,7 @@ def learn_cache_key(request, response, cache_timeout=None, key_prefix=None): key_prefix = settings.CACHE_MIDDLEWARE_KEY_PREFIX if cache_timeout is None: cache_timeout = settings.CACHE_MIDDLEWARE_SECONDS - cache_key = 'views.decorators.cache.cache_header.%s.%s' % (key_prefix, request.path) + cache_key = 'views.decorators.cache.cache_header.%s.%s' % (key_prefix, iri_to_uri(request.path)) if response.has_header('Vary'): headerlist = ['HTTP_'+header.upper().replace('-', '_') for header in vary_delim_re.split(response['Vary'])] cache.set(cache_key, headerlist, cache_timeout)