making pickled caches block no execution
[theonering] / src / gvoice / addressbook.py
index 5d29a06..4b3793b 100644 (file)
@@ -40,7 +40,7 @@ class Addressbook(object):
                try:
                        with open(path, "rb") as f:
                                fileVersion, fileBuild, contacts = pickle.load(f)
-               except (pickle.PickleError, IOError, EOFError, ValueError):
+               except (pickle.PickleError, IOError, EOFError, ValueError, Exception):
                        _moduleLogger.exception("While loading")
                        return
 
@@ -146,3 +146,16 @@ class Addressbook(object):
                                for (number, phoneType) in contactNumbers
                        )
                return numbers
+
+
+def print_addressbook(path):
+       import pprint
+
+       try:
+               with open(path, "rb") as f:
+                       fileVersion, fileBuild, contacts = pickle.load(f)
+       except (pickle.PickleError, IOError, EOFError, ValueError):
+               _moduleLogger.exception("")
+       else:
+               pprint.pprint((fileVersion, fileBuild))
+               pprint.pprint(contacts)