Loading django/template/loaders/cached.py +2 −1 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ to load templates from them in order, caching the result. import hashlib from django.template.base import TemplateDoesNotExist from django.template.loader import BaseLoader, get_template_from_string, find_template_loader, make_origin from django.utils.encoding import force_bytes class Loader(BaseLoader): is_usable = True Loading Loading @@ -40,7 +41,7 @@ class Loader(BaseLoader): key = template_name if template_dirs: # If template directories were specified, use a hash to differentiate key = '-'.join([template_name, hashlib.sha1('|'.join(template_dirs)).hexdigest()]) key = '-'.join([template_name, hashlib.sha1(force_bytes('|'.join(template_dirs))).hexdigest()]) if key not in self.template_cache: template, origin = self.find_template(template_name, template_dirs) Loading django/utils/cache.py +1 −1 Original line number Diff line number Diff line Loading @@ -181,7 +181,7 @@ def _generate_cache_key(request, method, headerlist, key_prefix): for header in headerlist: value = request.META.get(header, None) if value is not None: ctx.update(value) ctx.update(force_bytes(value)) path = hashlib.md5(force_bytes(iri_to_uri(request.get_full_path()))) cache_key = 'views.decorators.cache.cache_page.%s.%s.%s.%s' % ( key_prefix, method, path.hexdigest(), ctx.hexdigest()) Loading django/utils/crypto.py +2 −2 Original line number Diff line number Diff line Loading @@ -72,10 +72,10 @@ def get_random_string(length=12, # is better than absolute predictability. random.seed( hashlib.sha256( "%s%s%s" % ( ("%s%s%s" % ( random.getstate(), time.time(), settings.SECRET_KEY) settings.SECRET_KEY)).encode('utf-8') ).digest()) return ''.join([random.choice(allowed_chars) for i in range(length)]) Loading Loading
django/template/loaders/cached.py +2 −1 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ to load templates from them in order, caching the result. import hashlib from django.template.base import TemplateDoesNotExist from django.template.loader import BaseLoader, get_template_from_string, find_template_loader, make_origin from django.utils.encoding import force_bytes class Loader(BaseLoader): is_usable = True Loading Loading @@ -40,7 +41,7 @@ class Loader(BaseLoader): key = template_name if template_dirs: # If template directories were specified, use a hash to differentiate key = '-'.join([template_name, hashlib.sha1('|'.join(template_dirs)).hexdigest()]) key = '-'.join([template_name, hashlib.sha1(force_bytes('|'.join(template_dirs))).hexdigest()]) if key not in self.template_cache: template, origin = self.find_template(template_name, template_dirs) Loading
django/utils/cache.py +1 −1 Original line number Diff line number Diff line Loading @@ -181,7 +181,7 @@ def _generate_cache_key(request, method, headerlist, key_prefix): for header in headerlist: value = request.META.get(header, None) if value is not None: ctx.update(value) ctx.update(force_bytes(value)) path = hashlib.md5(force_bytes(iri_to_uri(request.get_full_path()))) cache_key = 'views.decorators.cache.cache_page.%s.%s.%s.%s' % ( key_prefix, method, path.hexdigest(), ctx.hexdigest()) Loading
django/utils/crypto.py +2 −2 Original line number Diff line number Diff line Loading @@ -72,10 +72,10 @@ def get_random_string(length=12, # is better than absolute predictability. random.seed( hashlib.sha256( "%s%s%s" % ( ("%s%s%s" % ( random.getstate(), time.time(), settings.SECRET_KEY) settings.SECRET_KEY)).encode('utf-8') ).digest()) return ''.join([random.choice(allowed_chars) for i in range(length)]) Loading