Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

utils.py 381B

123456789101112
  1. import hashlib
  2. from urllib.parse import quote
  3. TEMPLATE_FRAGMENT_KEY_TEMPLATE = 'template.cache.%s.%s'
  4. def make_template_fragment_key(fragment_name, vary_on=None):
  5. if vary_on is None:
  6. vary_on = ()
  7. key = ':'.join(quote(str(var)) for var in vary_on)
  8. args = hashlib.md5(key.encode())
  9. return TEMPLATE_FRAGMENT_KEY_TEMPLATE % (fragment_name, args.hexdigest())