diff backend/couchdb/CouchDbBackend.py @ 182:964661153b97

hide read feed entries if configured
author dirk
date Sat, 10 Sep 2011 09:15:25 +0200
parents 1ab48428e2f9
children ac1de0a467fd
line wrap: on
line diff
--- a/backend/couchdb/CouchDbBackend.py	Sat Sep 10 09:05:14 2011 +0200
+++ b/backend/couchdb/CouchDbBackend.py	Sat Sep 10 09:15:25 2011 +0200
@@ -52,12 +52,13 @@
         return feedsWithUnreadEntries
 
     def _retrieveEntriesForSelectedFeed(self, hideReadEntries):
-        # TODO how to hide read entries if requested?
         viewResults = FeedEntry.view(self.database, CouchDb.feedEntriesByFeed(),
             key=self.selectedFeed.id)
         viewResults = list(viewResults)
         # TODO update date is a string ... convert to a ListDateTimeField for better sort support
         viewResults.sort(FeedEntry.compareByUpdateDate, reverse=True)
+        if hideReadEntries:
+            viewResults = filter(lambda feedEntry: feedEntry.read == False, viewResults)
         return viewResults
 
     def markSelectedFeedAsRead(self):