comparison backend/couchdb/CouchDbBackend.py @ 256:f79be01821c4

Arangodb backend, first version which barely works for reading
author Dirk Olmes <dirk@xanthippe.ping.de>
date Wed, 30 Jan 2019 07:11:10 +0100
parents 8e73a8ae863f
children
comparison
equal deleted inserted replaced
255:b4c83e9b9c7a 256:f79be01821c4
32 return self.prefs 32 return self.prefs
33 33
34 # 34 #
35 # handling of feeds 35 # handling of feeds
36 # 36 #
37 37 def getUnreadFeeds(self):
38 def getFeeds(self):
39 if self.preferences().showOnlyUnreadFeeds():
40 self.feeds = self._getUnreadFeeds()
41 else:
42 # make sure that the results are actually fetched into memory, otherwise we'll pass
43 # a ViewResults instance around which is not what we want
44 self.feeds = list(Feed.all(self.database))
45 return self.feeds
46
47 def _getUnreadFeeds(self):
48 viewResults = self.database.view(CouchDb.feedsWithUnreadEntries(), group=True) 38 viewResults = self.database.view(CouchDb.feedsWithUnreadEntries(), group=True)
49 feedsWithUnreadEntries = [] 39 feedsWithUnreadEntries = []
50 for row in viewResults: 40 for row in viewResults:
51 feed = Feed.load(self.database, row["key"]) 41 feed = Feed.load(self.database, row["key"])
52 feedsWithUnreadEntries.append(feed) 42 feedsWithUnreadEntries.append(feed)
53 return feedsWithUnreadEntries 43 return feedsWithUnreadEntries
44
45 def getAllFeeds(self):
46 # make sure that the results are actually fetched into memory, otherwise we'll pass
47 # a ViewResults instance around which is not what we want
48 return list(Feed.all(self.database))
54 49
55 def _retrieveEntriesForSelectedFeed(self, hideReadEntries): 50 def _retrieveEntriesForSelectedFeed(self, hideReadEntries):
56 viewResults = FeedEntry.entriesForFeed(self.selectedFeed, self.database) 51 viewResults = FeedEntry.entriesForFeed(self.selectedFeed, self.database)
57 if hideReadEntries: 52 if hideReadEntries:
58 filterFunc = lambda feedEntry: feedEntry.read is False 53 filterFunc = lambda feedEntry: feedEntry.read is False