Cache version improvements
authorPlamen Dimitrov <plamen.dimitrov@intra2net.com>
Thu, 28 Jun 2012 09:31:53 +0000 (11:31 +0200)
committerPlamen Dimitrov <plamen.dimitrov@intra2net.com>
Thu, 28 Jun 2012 09:31:53 +0000 (11:31 +0200)
caching_data.py

index e40c3c3..c578a3b 100644 (file)
@@ -39,7 +39,7 @@ class CachingData:
             self.version, self.data = pickle.load(cachefile)
             if(self.version != CACHE_VERSION):
                 logging.warning("Cache file has version %s and the script version is %s.",
-                                self.version, self.data)
+                                self.version, CACHE_VERSION)
                 raise IOError
             logging.info("Cache version %s", self.version)
             logging.debug("%s users found.", len(self.data))
@@ -47,7 +47,7 @@ class CachingData:
             self.version = CACHE_VERSION
             self.data = {}
             with open(CACHE_FILENAME, 'wb') as cachefile:
-                pickle.dump((0, self.data), cachefile)
+                pickle.dump((self.version, self.data), cachefile)
 
     def __del__(self):
         # create temporary file first