From 6671b973e6de5abc46829a27fd3bbb989d68ca3a Mon Sep 17 00:00:00 2001 From: Wing Date: Sat, 17 May 2014 03:36:57 +0800 Subject: [PATCH] use abs path for cache key --- jinja2/environment.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jinja2/environment.py b/jinja2/environment.py index 45fabada..424335df 100644 --- a/jinja2/environment.py +++ b/jinja2/environment.py @@ -757,14 +757,16 @@ class Environment(object): def _load_template(self, name, globals): if self.loader is None: raise TypeError('no loader for this environment specified') + # use abs path to store cache + cache_key = self.loader.get_source(self, name)[1] if self.cache is not None: - template = self.cache.get(name) + template = self.cache.get(cache_key) if template is not None and (not self.auto_reload or \ template.is_up_to_date): return template template = self.loader.load(self, name, globals) if self.cache is not None: - self.cache[name] = template + self.cache[cache_key] = template return template @internalcode -- 2.47.2