aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-01-20 09:56:32 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-01-20 09:56:32 +0100
commitece7c8d5fcf5d91e8ff68b9023f73eeac6f20279 (patch)
tree54ab611e204acdfa00af31c13d89eaba8903928a
parentTest if the MongoDB collection exist before the creation. (diff)
downloadnewspipe-ece7c8d5fcf5d91e8ff68b9023f73eeac6f20279.tar.gz
newspipe-ece7c8d5fcf5d91e8ff68b9023f73eeac6f20279.tar.bz2
newspipe-ece7c8d5fcf5d91e8ff68b9023f73eeac6f20279.zip
get_feed() in mongodb.py should test the presence of a collection.
-rw-r--r--source/mongodb.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/mongodb.py b/source/mongodb.py
index a8d81aef..358b2746 100644
--- a/source/mongodb.py
+++ b/source/mongodb.py
@@ -76,7 +76,10 @@ class Articles(object):
"""
Return information about a feed.
"""
- return next(self.db[str(feed_id)].find())
+ try:
+ return next(self.db[str(feed_id)].find())
+ except:
+ return None
def get_all_feeds(self, condition=None):
"""
bgstack15