From a059e00533bb4e6ee8955e1c906ccd71115c014c Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Mon, 21 Jan 2013 19:33:28 +0100 Subject: Test if the article is present in the database before sending it via mail. --- source/mongodb.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/mongodb.py') diff --git a/source/mongodb.py b/source/mongodb.py index 7879adee..93894154 100644 --- a/source/mongodb.py +++ b/source/mongodb.py @@ -131,7 +131,10 @@ class Articles(object): elif feed_id != None and article_id != None: # Return a precise article. collection = self.db[str(feed_id)] - return next(collection.find({"article_id":article_id})) + try: + return next(collection.find({"article_id":article_id})) + except: + return False def get_favorites(self, feed_id=None): """ -- cgit