From f86baf554c75e88e3d54fbd0e2f581440a7a4ad3 Mon Sep 17 00:00:00 2001 From: "gw0 [http://gw.tnode.com/]" Date: Mon, 10 Jun 2013 22:43:50 +0200 Subject: [PATCH] Fix `mongodb_user` compatibility with MongoDB 2.2 (used in Debian 7). --- database/mongodb_user | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/database/mongodb_user b/database/mongodb_user index bba1c192d05..91506da4cb3 100644 --- a/database/mongodb_user +++ b/database/mongodb_user @@ -81,11 +81,16 @@ author: Elliott Foster import ConfigParser try: - from pymongo import MongoClient from pymongo.errors import ConnectionFailure from pymongo.errors import OperationFailure + from pymongo import MongoClient except ImportError: - pymongo_found = False + try: # for older PyMongo 2.2 + from pymongo import Connection as MongoClient + except ImportError: + pymongo_found = False + else: + pymongo_found = True else: pymongo_found = True