diff options
author | Cédric Bonhomme <kimble.mandel@gmail.com> | 2013-01-20 09:56:32 +0100 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel@gmail.com> | 2013-01-20 09:56:32 +0100 |
commit | ece7c8d5fcf5d91e8ff68b9023f73eeac6f20279 (patch) | |
tree | 54ab611e204acdfa00af31c13d89eaba8903928a /source | |
parent | Test if the MongoDB collection exist before the creation. (diff) | |
download | newspipe-ece7c8d5fcf5d91e8ff68b9023f73eeac6f20279.tar.gz newspipe-ece7c8d5fcf5d91e8ff68b9023f73eeac6f20279.tar.bz2 newspipe-ece7c8d5fcf5d91e8ff68b9023f73eeac6f20279.zip |
get_feed() in mongodb.py should test the presence of a collection.
Diffstat (limited to 'source')
-rw-r--r-- | source/mongodb.py | 5 |
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): """ |