File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -209,9 +209,10 @@ def _connect(self):
209
209
210
210
def pop (name , default = None ):
211
211
return settings .pop (name ) or default
212
+
212
213
db_name = pop ('NAME' )
213
214
host = pop ('HOST' )
214
- port = pop ('PORT' )
215
+ port = int ( pop ('PORT' , 27017 ) )
215
216
user = pop ('USER' )
216
217
password = pop ('PASSWORD' )
217
218
options = pop ('OPTIONS' , {})
@@ -236,12 +237,12 @@ def pop(name, default=None):
236
237
"Please use read_preference instead." )
237
238
238
239
if read_preference :
239
- Connection = MongoReplicaSetClient
240
+ connection = MongoReplicaSetClient
240
241
else :
241
- Connection = MongoClient
242
+ connection = MongoClient
242
243
243
244
try :
244
- self .connection = Connection (host = host , port = port , ** options )
245
+ self .connection = connection (host = host , port = port , ** options )
245
246
self .database = self .connection [db_name ]
246
247
except TypeError :
247
248
exc_info = sys .exc_info ()
You can’t perform that action at this time.
0 commit comments