Ticket #11270: cache_templatetag.patch

File cache_templatetag.patch, 1.1 KB (added by 235, 15 years ago)

django/templatetags/cache.py patch

  • templatetags/cache.py

    diff -rupN django/templatetags/cache.py django-my/templatetags/cache.py
    old new from django.template import resolve_vari  
    33from django.core.cache import cache
    44from django.utils.encoding import force_unicode
    55from django.utils.http import urlquote
     6from django.utils.hashcompat import md5_constructor
    67
    78register = Library()
    89
    class CacheNode(Node):  
    2324        except (ValueError, TypeError):
    2425            raise TemplateSyntaxError('"cache" tag got a non-integer timeout value: %r' % expire_time)
    2526        # Build a unicode key for this fragment and all vary-on's.
    26         cache_key = u':'.join([self.fragment_name] + [urlquote(resolve_variable(var, context)) for var in self.vary_on])
     27        cache_key = md5_constructor()
     28        cache_key.update(u':'.join([self.fragment_name] + [urlquote(resolve_variable(var, context)) for var in self.vary_on]))
     29        cache_key = cache_key.hexdigest()
    2730        value = cache.get(cache_key)
    2831        if value is None:
    2932            value = self.nodelist.render(context)
Back to Top