aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2012-10-20 15:52:06 +0200
committercedricbonhomme <devnull@localhost>2012-10-20 15:52:06 +0200
commit09aeb1c823455efb5b563b7416a855dfc1dd26ce (patch)
treea98d14cb17b8203fc7add36ec8c192e207b9b029
parentAdded comments. (diff)
downloadnewspipe-09aeb1c823455efb5b563b7416a855dfc1dd26ce.tar.gz
newspipe-09aeb1c823455efb5b563b7416a855dfc1dd26ce.tar.bz2
newspipe-09aeb1c823455efb5b563b7416a855dfc1dd26ce.zip
Catch an error when creating index with mongodb and python 2.7.3.
-rw-r--r--source/mongodb.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/mongodb.py b/source/mongodb.py
index 8d1a4848..8d07bf38 100644
--- a/source/mongodb.py
+++ b/source/mongodb.py
@@ -55,8 +55,11 @@ class Articles(object):
"""
collection = self.db[str(feed_id)]
- collection.create_index([("article_date", pymongo.DESCENDING)], \
+ try:
+ collection.create_index([("article_date", pymongo.DESCENDING)], \
{"unique":False, "sparse":False})
+ except:
+ print "Oups"
for article in articles:
cursor = collection.find({"article_id":article["article_id"]})
bgstack15