diff options
author | cedricbonhomme <devnull@localhost> | 2012-10-20 15:52:06 +0200 |
---|---|---|
committer | cedricbonhomme <devnull@localhost> | 2012-10-20 15:52:06 +0200 |
commit | 09aeb1c823455efb5b563b7416a855dfc1dd26ce (patch) | |
tree | a98d14cb17b8203fc7add36ec8c192e207b9b029 | |
parent | Added comments. (diff) | |
download | newspipe-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.py | 5 |
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"]}) |