Ticket #7460: django_templatetags_cache-key-quote.diff
| File django_templatetags_cache-key-quote.diff, 1.0 kB (added by trbs, 2 years ago) |
|---|
-
a/django/templatetags/cache.py
old new 2 2 from django.template import resolve_variable 3 3 from django.core.cache import cache 4 4 from django.utils.encoding import force_unicode 5 from django.utils.http import urlquote 5 6 6 7 register = Library() 7 8 … … 22 23 except (ValueError, TypeError): 23 24 raise TemplateSyntaxError('"cache" tag got a non-integer timeout value: %r' % expire_time) 24 25 # 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]) 26 27 value = cache.get(cache_key) 27 28 if value is None: 28 29 value = self.nodelist.render(context)
