Mercurial > hg > Feedworm
comparison 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 |
comparison
equal
deleted
inserted
replaced
145:71c5dc02ff87 | 146:8ec20377bcb0 |
---|---|
1 | 1 |
2 from FeedUpdater import FeedUpdater | 2 from FeedUpdater import FeedUpdater |
3 from Preferences import Preferences | 3 from Preferences import Preferences |
4 from backend.couchdb.Feed import Feed | 4 from backend.couchdb.Feed import Feed |
5 from backend.couchdb.FeedEntry import FeedEntry | |
5 import couchdb | 6 import couchdb |
6 | 7 |
7 | 8 |
8 DATABASE = "feedtest" | 9 DATABASE = "feedtest" |
9 | 10 |
18 | 19 |
19 def preferences(self): | 20 def preferences(self): |
20 return Preferences(self.database) | 21 return Preferences(self.database) |
21 | 22 |
22 def getFeeds(self): | 23 def getFeeds(self): |
24 if self.preferences().showOnlyUnreadFeeds(): | |
25 return self._getUnreadFeeds() | |
26 else: | |
27 return Feed.all(self.database) | |
28 | |
29 def _getUnreadFeeds(self): | |
23 raise Exception("not yet implemented") | 30 raise Exception("not yet implemented") |
24 | 31 |
25 def toggleRead(self, feedEntry): | 32 def toggleRead(self, feedEntry): |
26 raise Exception("not yet implemented") | 33 raise Exception("not yet implemented") |
27 | 34 |
34 def updateFeed(self, feed, changes): | 41 def updateFeed(self, feed, changes): |
35 raise Exception("not yet implemented") | 42 raise Exception("not yet implemented") |
36 | 43 |
37 def deleteFeed(self, feed): | 44 def deleteFeed(self, feed): |
38 raise Exception("not yet implemented") | 45 raise Exception("not yet implemented") |
46 | |
47 def entriesForFeed(self, feed, hideReadEntries): | |
48 viewName = "feedtest/feedEntries_by_feed" | |
49 if hideReadEntries: | |
50 viewName = "feedtest/unread_feedEntries_by_feed" | |
51 viewResults = self.database.view(viewName) | |
52 return [FeedEntry(row) for row in viewResults] | |
39 | 53 |
40 def markFeedEntriesAsRead(self, entries): | 54 def markFeedEntriesAsRead(self, entries): |
41 raise Exception("not yet implemented") | 55 raise Exception("not yet implemented") |
42 | 56 |
43 def updateAllFeeds(self): | 57 def updateAllFeeds(self): |