From fe6d5a2da2ee0430a8fd7360816e6a3e4f843703 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Fri, 18 Jan 2019 10:14:41 -0500 Subject: [PATCH] Fixed #30107 -- Removed unused dirs variable from cache template loader keys. Unused since 5d8da093a974f41e08573bbe0d32d5ffeaadd0ad. --- django/template/loaders/cached.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/django/template/loaders/cached.py b/django/template/loaders/cached.py index 8d67ae2566..fcd2bc080b 100644 --- a/django/template/loaders/cached.py +++ b/django/template/loaders/cached.py @@ -66,7 +66,7 @@ class Loader(BaseLoader): 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 in the cache key. This ensures each template is only parsed and cached @@ -76,7 +76,6 @@ class Loader(BaseLoader): y -> a -> a z -> a -> a """ - dirs_prefix = '' skip_prefix = '' if skip: @@ -84,7 +83,7 @@ class Loader(BaseLoader): if 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): return hashlib.sha1('|'.join(values).encode()).hexdigest()