Mercurial > hg > Feedworm
changeset 183:ac1de0a467fd
clean up
author | dirk |
---|---|
date | Sun, 11 Sep 2011 06:51:14 +0200 |
parents | 964661153b97 |
children | 006477cdc7de |
files | backend/couchdb/CouchDbBackend.py backend/couchdb/FeedEntry.py |
diffstat | 2 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/backend/couchdb/CouchDbBackend.py Sat Sep 10 09:15:25 2011 +0200 +++ b/backend/couchdb/CouchDbBackend.py Sun Sep 11 06:51:14 2011 +0200 @@ -52,13 +52,12 @@ return feedsWithUnreadEntries def _retrieveEntriesForSelectedFeed(self, hideReadEntries): - viewResults = FeedEntry.view(self.database, CouchDb.feedEntriesByFeed(), - key=self.selectedFeed.id) - viewResults = list(viewResults) + viewResults = FeedEntry.entriesForFeed(self.selectedFeed, self.database) # 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) + filterFunc = lambda feedEntry: feedEntry.read == False + viewResults = filter(filterFunc, viewResults) return viewResults def markSelectedFeedAsRead(self):
--- a/backend/couchdb/FeedEntry.py Sat Sep 10 09:15:25 2011 +0200 +++ b/backend/couchdb/FeedEntry.py Sun Sep 11 06:51:14 2011 +0200 @@ -32,6 +32,11 @@ def compareByUpdateDate(first, second): return cmp(first, second) + @staticmethod + def entriesForFeed(feed, database): + viewResults = FeedEntry.view(database, CouchDb.feedEntriesByFeed(), key=feed.id) + return list(viewResults) + def markRead(self, database): self.read = True self.store(database)