fixed Issue 1532:mongodb: why to catch connection exceptions? thanks Alan
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.5.1-stable+timestamp.2013.06.16.03.25.54
|
Version 2.5.1-stable+timestamp.2013.06.16.06.51.32
|
||||||
|
|||||||
+7
-11
@@ -5223,18 +5223,14 @@ class MongoDBAdapter(NoSQLAdapter):
|
|||||||
m = {"database" : m[1]}
|
m = {"database" : m[1]}
|
||||||
if m.get('database')==None:
|
if m.get('database')==None:
|
||||||
raise SyntaxError("Database is required!")
|
raise SyntaxError("Database is required!")
|
||||||
|
|
||||||
def connector(uri=self.uri,m=m):
|
def connector(uri=self.uri,m=m):
|
||||||
try:
|
# Connection() is deprecated
|
||||||
# Connection() is deprecated
|
if hasattr(self.driver, "MongoClient"):
|
||||||
if hasattr(self.driver, "MongoClient"):
|
Connection = self.driver.MongoClient
|
||||||
Connection = self.driver.MongoClient
|
else:
|
||||||
else:
|
Connection = self.driver.Connection
|
||||||
Connection = self.driver.Connection
|
return Connection(uri)[m.get('database')]
|
||||||
return Connection(uri)[m.get('database')]
|
|
||||||
except self.driver.errors.ConnectionFailure:
|
|
||||||
inst = sys.exc_info()[1]
|
|
||||||
raise SyntaxError("The connection to " +
|
|
||||||
uri + " could not be made")
|
|
||||||
|
|
||||||
self.reconnect(connector,cursor=False)
|
self.reconnect(connector,cursor=False)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user