comparison backend/AbstractBackend.py @ 155:a05719a6175e

move common functionality into an abstract backend class, have both backends inherit from it. Implement enough of the couchdb backend that reading feeds (and marking feed entries as read) is possible
author Dirk Olmes <dirk@xanthippe.ping.de>
date Sat, 27 Aug 2011 08:52:03 +0200
parents
children 3bcf39181f6e
comparison
equal deleted inserted replaced
154:2682db280be0 155:a05719a6175e
1
2 class AbstractBackend(object):
3 def __init__(self):
4 self.feeds = []
5 self.selectedFeed = None
6 self.feedEntries = None
7 self.selectedFeedEntry = None
8
9 def dispose(self):
10 pass
11
12 #
13 # handling of feeds
14 #
15
16 def selectFeed(self, index):
17 self.selectedFeed = self.feeds[index]
18 self.feedEntries = None
19 return self.selectedFeed
20
21 def entriesForSelectedFeed(self):
22 if self.feedEntries is None:
23 hideReadEntries = self.preferences().hideReadFeedEntries()
24 self.feedEntries = self._retrieveEntriesForSelectedFeed(hideReadEntries)
25 return self.feedEntries
26
27 #
28 # handling of the selected feed entry
29 #
30
31 def selectFeedEntry(self, index):
32 self.selectedFeedEntry = self.feedEntries[index]
33 self._markSelectedFeedEntryRead()
34 return self.selectedFeedEntry