Mercurial > hg > Feedworm
comparison 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 |
comparison
equal
deleted
inserted
replaced
181:1ab48428e2f9 | 182:964661153b97 |
---|---|
50 feed = Feed.load(self.database, row["key"]) | 50 feed = Feed.load(self.database, row["key"]) |
51 feedsWithUnreadEntries.append(feed) | 51 feedsWithUnreadEntries.append(feed) |
52 return feedsWithUnreadEntries | 52 return feedsWithUnreadEntries |
53 | 53 |
54 def _retrieveEntriesForSelectedFeed(self, hideReadEntries): | 54 def _retrieveEntriesForSelectedFeed(self, hideReadEntries): |
55 # TODO how to hide read entries if requested? | |
56 viewResults = FeedEntry.view(self.database, CouchDb.feedEntriesByFeed(), | 55 viewResults = FeedEntry.view(self.database, CouchDb.feedEntriesByFeed(), |
57 key=self.selectedFeed.id) | 56 key=self.selectedFeed.id) |
58 viewResults = list(viewResults) | 57 viewResults = list(viewResults) |
59 # TODO update date is a string ... convert to a ListDateTimeField for better sort support | 58 # TODO update date is a string ... convert to a ListDateTimeField for better sort support |
60 viewResults.sort(FeedEntry.compareByUpdateDate, reverse=True) | 59 viewResults.sort(FeedEntry.compareByUpdateDate, reverse=True) |
60 if hideReadEntries: | |
61 viewResults = filter(lambda feedEntry: feedEntry.read == False, viewResults) | |
61 return viewResults | 62 return viewResults |
62 | 63 |
63 def markSelectedFeedAsRead(self): | 64 def markSelectedFeedAsRead(self): |
64 for feedEntry in self.entriesForSelectedFeed(): | 65 for feedEntry in self.entriesForSelectedFeed(): |
65 feedEntry.markRead(self.database) | 66 feedEntry.markRead(self.database) |