comparison backend/couchdb/CouchDbBackend.py @ 183:ac1de0a467fd

clean up
author dirk
date Sun, 11 Sep 2011 06:51:14 +0200
parents 964661153b97
children e5d492595bdb
comparison
equal deleted inserted replaced
182:964661153b97 183:ac1de0a467fd
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 viewResults = FeedEntry.view(self.database, CouchDb.feedEntriesByFeed(), 55 viewResults = FeedEntry.entriesForFeed(self.selectedFeed, self.database)
56 key=self.selectedFeed.id)
57 viewResults = list(viewResults)
58 # TODO update date is a string ... convert to a ListDateTimeField for better sort support 56 # TODO update date is a string ... convert to a ListDateTimeField for better sort support
59 viewResults.sort(FeedEntry.compareByUpdateDate, reverse=True) 57 viewResults.sort(FeedEntry.compareByUpdateDate, reverse=True)
60 if hideReadEntries: 58 if hideReadEntries:
61 viewResults = filter(lambda feedEntry: feedEntry.read == False, viewResults) 59 filterFunc = lambda feedEntry: feedEntry.read == False
60 viewResults = filter(filterFunc, viewResults)
62 return viewResults 61 return viewResults
63 62
64 def markSelectedFeedAsRead(self): 63 def markSelectedFeedAsRead(self):
65 for feedEntry in self.entriesForSelectedFeed(): 64 for feedEntry in self.entriesForSelectedFeed():
66 feedEntry.markRead(self.database) 65 feedEntry.markRead(self.database)