From: Wing Date: Fri, 16 May 2014 19:36:57 +0000 (+0800) Subject: use abs path for cache key X-Git-Tag: 2.8~93^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6671b973e6de5abc46829a27fd3bbb989d68ca3a;p=thirdparty%2Fjinja.git use abs path for cache key --- 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