comparison backend/couchdb/CouchDbBackend.py @ 176:7001070d0bd5

clean code
author dirk
date Fri, 09 Sep 2011 18:19:01 +0200
parents 57e324fa4350
children a4832a180c69
comparison
equal deleted inserted replaced
175:57e324fa4350 176:7001070d0bd5
37 self.feeds = list(Feed.all(self.database)) 37 self.feeds = list(Feed.all(self.database))
38 return self.feeds 38 return self.feeds
39 39
40 def _getUnreadFeeds(self): 40 def _getUnreadFeeds(self):
41 viewResults = self.database.view(CouchDb.feedsWithUnreadEntries(), group=True) 41 viewResults = self.database.view(CouchDb.feedsWithUnreadEntries(), group=True)
42 feeds = [] 42 feedsWithUnreadEntries = []
43 for row in viewResults: 43 for row in viewResults:
44 feeds.append(Feed.load(self.database, row["key"])) 44 feed = Feed.load(self.database, row["key"])
45 return feeds 45 feedsWithUnreadEntries.append(feed)
46 return feedsWithUnreadEntries
46 47
47 def _retrieveEntriesForSelectedFeed(self, hideReadEntries): 48 def _retrieveEntriesForSelectedFeed(self, hideReadEntries):
48 # TODO how to hide read entries if requested? 49 # TODO how to hide read entries if requested?
49 viewResults = FeedEntry.view(self.database, CouchDb.feedEntriesByFeed(), 50 viewResults = FeedEntry.view(self.database, CouchDb.feedEntriesByFeed(),
50 key=self.selectedFeed.id) 51 key=self.selectedFeed.id)