From 2e46a5c1744067b2c05f7ae55d4f606748443a5c Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Wed, 17 Sep 2008 22:25:04 +0200 Subject: [PATCH] Fixed FileSystemBytecodeCache.clear --HG-- branch : trunk --- jinja2/bccache.py | 3 ++- jinja2/loaders.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/jinja2/bccache.py b/jinja2/bccache.py index ff3dd69..149c0c0 100644 --- a/jinja2/bccache.py +++ b/jinja2/bccache.py @@ -208,7 +208,8 @@ class FileSystemBytecodeCache(BytecodeCache): f.close() def clear(self): - for filename in filter(listdir(self.directory), self.pattern % '*'): + files = fnmatch.filter(listdir(self.directory), self.pattern % '*') + for filename in files: try: remove(path.join(self.directory, filename)) except OSError: diff --git a/jinja2/loaders.py b/jinja2/loaders.py index dff95f7..264b123 100644 --- a/jinja2/loaders.py +++ b/jinja2/loaders.py @@ -211,7 +211,7 @@ class DictLoader(BaseLoader): def get_source(self, environment, template): if template in self.mapping: source = self.mapping[template] - return source, None, lambda: source != self.mapping[template] + return source, None, lambda: source != self.mapping.get(template) raise TemplateNotFound(template) -- 2.26.2