# HG changeset patch # User Dirk Olmes # Date 1314332019 -7200 # Node ID c5a427d46703bf4453db3baa1ee21ccb91aaca12 # Parent b290e29a94b56af7cb89742a456a312b56d9b461 displaying entries for a feed works now with the couchdb backend diff -r b290e29a94b5 -r c5a427d46703 DisplayModel.py --- 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 diff -r b290e29a94b5 -r c5a427d46703 backend/couchdb/CouchDbBackend.py --- 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")