Ticket #13672: tcache.diff

File tcache.diff, 930 bytes (added by nbv4, 5 years ago)
  • django/templatetags/cache.py

     
    2424        except (ValueError, TypeError):
    2525            raise TemplateSyntaxError('"cache" tag got a non-integer timeout value: %r' % expire_time)
    2626        # Build a unicode key for this fragment and all vary-on's.
    27         args = md5_constructor(u':'.join([urlquote(resolve_variable(var, context)) for var in self.vary_on]))
     27        keys = ""
     28        for var in self.vary_on:
     29            try:
     30                keys += ":" + urlquote(resolve_variable(var, context))
     31            except:
     32                keys += ":None"
     33        args = md5_constructor(keys)
    2834        cache_key = 'template.cache.%s.%s' % (self.fragment_name, args.hexdigest())
    2935        value = cache.get(cache_key)
    3036        if value is None:
Back to Top