From b31b906b80317adc2e4f9cec91022937487f0c63 Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Thu, 5 Jul 2012 11:07:54 +0200 Subject: [PATCH] Correctly update fallback_to_date_header setting in case we are unable to load the cache --- src/caching_data.py | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/caching_data.py b/src/caching_data.py index ab3e4ad..d9b9359 100644 --- a/src/caching_data.py +++ b/src/caching_data.py @@ -42,9 +42,9 @@ class CachingData: cache_info, self.data = pickle.load(cachefile) cache_info = cache_info.split(' ') self.version = cache_info[0] + self.fallback_to_date_header = cache_info[1] if(self.version != CACHE_VERSION): raise IOError("Cache file has version %s and the script version is %s" % (self.version, CACHE_VERSION)) - self.fallback_to_date_header = cache_info[1] if(self.fallback_to_date_header != str(fallback_mode)): raise IOError("Cache file date fallback mode setting is different than current settings") logging.info("Cache file %s loaded", CACHE_FILENAME) @@ -53,7 +53,8 @@ class CachingData: logging.warning("Couldn't load cache file %s: %s", CACHE_FILENAME, ex) logging.warning("DELETING CACHE") self.version = CACHE_VERSION - stored_cache_info = self.version + ' ' + str(fallback_mode) + self.fallback_to_date_header = str(fallback_mode) + stored_cache_info = self.version + ' ' + self.fallback_to_date_header self.data = {} with open(CACHE_FILENAME, 'wb') as cachefile: pickle.dump((stored_cache_info, self.data), cachefile) -- 1.7.1