Commits

Aleš Erjavec committed 6d87bc9

Cache entry should be invalid if unpickling raises an error.

Comments (0)

Files changed (2)

orangecontrib/bio/obiKEGG/api.py

         path = conf.params["cache.path"]
         touch_dir(path)
         return caching.Sqlite3Store(os.path.join(path,
-                                                 "kegg_api_cache_1.sqlite3"))
+                                                 "kegg_api_cache_2.sqlite3"))
 
     def last_modified(self, args, kwargs=None):
         return getattr(self, "default_release", "")

orangecontrib/bio/obiKEGG/caching.py

         if not r:
             raise KeyError(key)
         else:
-            return pickle.loads(str(r[0][0]))
+            pickle_str = str(r[0][0])
+            try:
+                return pickle.loads(pickle_str)
+            except Exception:
+                raise KeyError(key)
 
     def __setitem__(self, key, value):
         value = pickle.dumps(value)