From: Thomas Jarosch Date: Thu, 5 Jul 2012 09:07:54 +0000 (+0200) Subject: Correctly update fallback_to_date_header setting in case we are unable to load the... X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=b31b906b80317adc2e4f9cec91022937487f0c63;p=imap-fix-internaldate Correctly update fallback_to_date_header setting in case we are unable to load the cache --- 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)