Mercurial > hg > Feedworm
diff backend/couchdb/CouchDbBackend.py @ 146:8ec20377bcb0
move getting the entries for a feed to the backend so that the couchdb backend can use a custom view for feed entries
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Thu, 25 Aug 2011 07:01:45 +0200 |
parents | 74217db92993 |
children | c5a427d46703 |
line wrap: on
line diff
--- a/backend/couchdb/CouchDbBackend.py Thu Aug 25 05:39:03 2011 +0200 +++ b/backend/couchdb/CouchDbBackend.py Thu Aug 25 07:01:45 2011 +0200 @@ -2,6 +2,7 @@ from FeedUpdater import FeedUpdater from Preferences import Preferences from backend.couchdb.Feed import Feed +from backend.couchdb.FeedEntry import FeedEntry import couchdb @@ -20,6 +21,12 @@ return Preferences(self.database) def getFeeds(self): + if self.preferences().showOnlyUnreadFeeds(): + return self._getUnreadFeeds() + else: + return Feed.all(self.database) + + def _getUnreadFeeds(self): raise Exception("not yet implemented") def toggleRead(self, feedEntry): @@ -37,6 +44,13 @@ def deleteFeed(self, feed): raise Exception("not yet implemented") + def entriesForFeed(self, feed, hideReadEntries): + viewName = "feedtest/feedEntries_by_feed" + if hideReadEntries: + viewName = "feedtest/unread_feedEntries_by_feed" + viewResults = self.database.view(viewName) + return [FeedEntry(row) for row in viewResults] + def markFeedEntriesAsRead(self, entries): raise Exception("not yet implemented")