1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #30107 -- Removed unused dirs variable from cache template loader keys.

Unused since 5d8da093a9.
This commit is contained in:
Tim Graham
2019-01-18 10:14:41 -05:00
committed by GitHub
parent 6713926ebe
commit fe6d5a2da2

View File

@@ -66,7 +66,7 @@ class Loader(BaseLoader):
def cache_key(self, template_name, skip=None): def cache_key(self, template_name, skip=None):
""" """
Generate a cache key for the template name, dirs, and skip. Generate a cache key for the template name and skip.
If skip is provided, only origins that match template_name are included If skip is provided, only origins that match template_name are included
in the cache key. This ensures each template is only parsed and cached in the cache key. This ensures each template is only parsed and cached
@@ -76,7 +76,6 @@ class Loader(BaseLoader):
y -> a -> a y -> a -> a
z -> a -> a z -> a -> a
""" """
dirs_prefix = ''
skip_prefix = '' skip_prefix = ''
if skip: if skip:
@@ -84,7 +83,7 @@ class Loader(BaseLoader):
if matching: if matching:
skip_prefix = self.generate_hash(matching) skip_prefix = self.generate_hash(matching)
return '-'.join(s for s in (str(template_name), skip_prefix, dirs_prefix) if s) return '-'.join(s for s in (str(template_name), skip_prefix) if s)
def generate_hash(self, values): def generate_hash(self, values):
return hashlib.sha1('|'.join(values).encode()).hexdigest() return hashlib.sha1('|'.join(values).encode()).hexdigest()