If Disconnect comes between start of Connect and getting a response back
authorEd Page <eopage@byu.net>
Sat, 24 Apr 2010 02:46:28 +0000 (21:46 -0500)
committerEd Page <eopage@byu.net>
Sat, 24 Apr 2010 02:46:28 +0000 (21:46 -0500)
from google's website, then everything would be canceled and we go
through the disconnect code path.  Sadly this means we save the cache
even though we never loaded it.  This would then cause old messages to
be displayed as new.

Watching for empty caches and treating it as if the cache didn't exist

src/gvoice/conversations.py

index b48887e..ed10b9c 100644 (file)
@@ -47,7 +47,7 @@ class Conversations(object):
                        _moduleLogger.exception("While loading for %s" % self._name)
                        return
 
-               if misc_utils.compare_versions(
+               if convs and misc_utils.compare_versions(
                        self.OLDEST_COMPATIBLE_FORMAT_VERSION,
                        misc_utils.parse_version(fileVersion),
                ) <= 0:
@@ -70,6 +70,10 @@ class Conversations(object):
 
        def save(self, path):
                _moduleLogger.info("%s Saving cache" % (self._name, ))
+               if not self._conversations:
+                       _moduleLogger.info("%s Odd, no conversations to cache.  Did we never load the cache?" % (self._name, ))
+                       return
+
                try:
                        dataToDump = (constants.__version__, constants.__build__, self._conversations)
                        with open(path, "wb") as f: