Mercurial > hg > Feedworm
changeset 148:c5a427d46703
displaying entries for a feed works now with the couchdb backend
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Fri, 26 Aug 2011 06:13:39 +0200 |
parents | b290e29a94b5 |
children | 92194216f70d |
files | DisplayModel.py backend/couchdb/CouchDbBackend.py |
diffstat | 2 files changed, 9 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/DisplayModel.py Thu Aug 25 11:05:05 2011 +0200 +++ b/DisplayModel.py Fri Aug 26 06:13:39 2011 +0200 @@ -13,14 +13,14 @@ def data(self, index, role): if index.isValid() and role == Qt.DisplayRole: row = index.row() - object = self.list[row] - displayString = self._stringToDisplay(object) + item = self.list[row] + displayString = self._stringToDisplay(item) return QVariant(displayString) else: return QVariant() - def _stringToDisplay(self, object): - if hasattr(object, self.displayAttribute): - return getattr(object, self.displayAttribute) + def _stringToDisplay(self, item): + if hasattr(item, self.displayAttribute): + return getattr(item, self.displayAttribute) else: return "invalid display attribute: " + self.displayAttribute
--- a/backend/couchdb/CouchDbBackend.py Thu Aug 25 11:05:05 2011 +0200 +++ b/backend/couchdb/CouchDbBackend.py Fri Aug 26 06:13:39 2011 +0200 @@ -24,7 +24,9 @@ if self.preferences().showOnlyUnreadFeeds(): return self._getUnreadFeeds() else: - return Feed.all(self.database) + # make sure that the results are actually fetched into memory, otherwise we'll pass + # a ViewResults instance around which is not what we want + return list(Feed.all(self.database)) def _getUnreadFeeds(self): raise Exception("not yet implemented") @@ -48,8 +50,7 @@ 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] + return list(FeedEntry.view(self.database, viewName)) def markFeedEntriesAsRead(self, entries): raise Exception("not yet implemented")