From 72ae44813e65af42e3c62e2c77716244f7bdda05 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Sat, 7 Apr 2007 18:38:00 +0200 Subject: [PATCH] [svn] fixed another bug in the same darn file --HG-- branch : trunk --- jinja/loaders.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/jinja/loaders.py b/jinja/loaders.py index fb904a1..7bd63a8 100644 --- a/jinja/loaders.py +++ b/jinja/loaders.py @@ -191,13 +191,19 @@ class CachedLoaderMixin(object): try: cache_time = path.getmtime(cache_fn) except OSError: - cache_time = -1 - if last_change is None or last_change <= cache_time: - f = file(cache_fn, 'rb') + cache_time = 0 + if last_change is None or (cache_time and + last_change <= cache_time): try: - tmpl = Template.load(environment, f) - finally: - f.close() + f = file(cache_fn, 'rb') + except IOError: + tmpl = None + save_to_disk = True + else: + try: + tmpl = Template.load(environment, f) + finally: + f.close() else: save_to_disk = True -- 2.26.2