Fix a bug in isEntryRead for unknwn IDs
authorThomas Perl <thp@thpinfo.com>
Thu, 10 Jun 2010 11:42:48 +0000 (13:42 +0200)
committerThomas Perl <thp@thpinfo.com>
Thu, 10 Jun 2010 11:42:48 +0000 (13:42 +0200)
I experienced a bug that prevented me from opening
a feed in the UI, because the isEntryRead function
raised a KeyError for an unknown entry ID.

src/rss.py

index fd0dc5b..a174280 100644 (file)
@@ -313,7 +313,9 @@ class Feed:
             self.readItems[id] = False
     
     def isEntryRead(self, id):
-        return self.readItems[id]
+        # Check if an entry is read; return False if the read
+        # status of an entry is unknown (id not in readItems)
+        return self.readItems.get(id, False)
     
     def getTitle(self, id):
         return self.entries[id]["title"]