Mercurial > hg > Feedworm
comparison backend/couchdb/CouchDbBackend.py @ 204:4cb22b47b659
Due to a bug in CouchDB it's possible that a view still references deleted documents. Detect this case and don't add NoneType objects into the list of feeds.
author | dirk |
---|---|
date | Tue, 03 Apr 2012 05:35:13 +0200 |
parents | 50b578588405 |
children | 1ac0b8e2feae 524cbf9e413c |
comparison
equal
deleted
inserted
replaced
203:173fd7b9198f | 204:4cb22b47b659 |
---|---|
46 def _getUnreadFeeds(self): | 46 def _getUnreadFeeds(self): |
47 viewResults = self.database.view(CouchDb.feedsWithUnreadEntries(), group=True) | 47 viewResults = self.database.view(CouchDb.feedsWithUnreadEntries(), group=True) |
48 feedsWithUnreadEntries = [] | 48 feedsWithUnreadEntries = [] |
49 for row in viewResults: | 49 for row in viewResults: |
50 feed = Feed.load(self.database, row["key"]) | 50 feed = Feed.load(self.database, row["key"]) |
51 feedsWithUnreadEntries.append(feed) | 51 # see https://issues.apache.org/jira/browse/COUCHDB-1279 |
52 # it's possible that the view references documents that have already been deleted | |
53 if feed is not None: | |
54 feedsWithUnreadEntries.append(feed) | |
52 return feedsWithUnreadEntries | 55 return feedsWithUnreadEntries |
53 | 56 |
54 def _retrieveEntriesForSelectedFeed(self, hideReadEntries): | 57 def _retrieveEntriesForSelectedFeed(self, hideReadEntries): |
55 viewResults = FeedEntry.entriesForFeed(self.selectedFeed, self.database) | 58 viewResults = FeedEntry.entriesForFeed(self.selectedFeed, self.database) |
56 if hideReadEntries: | 59 if hideReadEntries: |