[conduit/gsoc09_alexandre: 6/6] Fixed type checking for cache.
- From: Alexandre Rosenfeld <arosenfeld src gnome org>
- To: svn-commits-list gnome org
- Subject: [conduit/gsoc09_alexandre: 6/6] Fixed type checking for cache.
- Date: Sun, 7 Jun 2009 23:41:58 -0400 (EDT)
commit ac783e49c9a076d59073ba3ec724bce68446d1a8
Author: Alexandre Rosenfeld <airmind gmail com>
Date: Thu Jun 4 00:17:49 2009 -0300
Fixed type checking for cache.
---
conduit/Module.py | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/conduit/Module.py b/conduit/Module.py
index 50b1b7e..02c4176 100644
--- a/conduit/Module.py
+++ b/conduit/Module.py
@@ -68,14 +68,21 @@ class ModuleManager(gobject.GObject):
if os.path.exists(self.cache_path):
cache_file = open(self.cache_path, "rb")
try:
+ num_modules = 0
+ num_files = 0
self.modules_cache = pickle.load(cache_file)
if not isinstance(self.modules_cache, dict):
raise Exception()
for key, value in self.modules_cache.iteritems():
- if not isinstance(key, basestring) and not isinstance(value, float):
- raise Exception()
- #log.critical("Modules cache loaded %s" % self.modules_cache)
- except:
+ if not isinstance(key, basestring):
+ raise Error("%s not a string" % key)
+ if not isinstance(value, dict):
+ raise Error("%s not a dict" % value)
+ for item in value:
+ num_modules += 1
+ num_files += 1
+ log.critical("Number of files %d, Number of modules %d" % (num_files, num_modules))
+ except Error:
log.warn("Modules cache invalid")
self.modules_cache = {}
finally:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]