Ticket #7460: django_templatetags_cache-key-quote.diff

File django_templatetags_cache-key-quote.diff, 992 bytes (added by trbs, 16 years ago)
  • django/templatetags/cache.py

    diff -r 00e4e4b60c7f django/templatetags/cache.py
    a b  
    22from django.template import resolve_variable
    33from django.core.cache import cache
    44from django.utils.encoding import force_unicode
     5from django.utils.http import urlquote
    56
    67register = Library()
    78
     
    2223        except (ValueError, TypeError):
    2324            raise TemplateSyntaxError('"cache" tag got a non-integer timeout value: %r' % expire_time)
    2425        # Build a unicode key for this fragment and all vary-on's.
    25         cache_key = u':'.join([self.fragment_name] + [force_unicode(resolve_variable(var, context)) for var in self.vary_on])
     26        cache_key = u':'.join([self.fragment_name] + [urlquote(resolve_variable(var, context)) for var in self.vary_on])
    2627        value = cache.get(cache_key)
    2728        if value is None:
    2829            value = self.nodelist.render(context)
Back to Top