Skip to content

Commit

Permalink
Merge pull request #29 from RasPhilCo/mongo-disconnect
Browse files Browse the repository at this point in the history
Replace deprecated .disconnect() with .close(), fixes #29
  • Loading branch information
tcstool committed Aug 19, 2015
2 parents 7c7f177 + f2ee82d commit 898a60b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions nsmmongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,16 +372,16 @@ def mongoScan(ip,port,pingIt):
try:
dbList = conn.database_names()
dbVer = conn.server_info()['version']
conn.disconnect()
conn.close()
return [0,dbVer]

except:
if str(sys.exc_info()).find('need to login') != -1:
conn.disconnect()
conn.close()
return [1,None]

else:
conn.disconnect()
conn.close()
return [2,None]

except:
Expand All @@ -396,16 +396,16 @@ def mongoScan(ip,port,pingIt):
try:
dbList = conn.database_names()
dbVer = conn.server_info()['version']
conn.disconnect()
conn.close()
return [0,dbVer]

except Exception, e:
if str(e).find('need to login') != -1:
conn.disconnect()
conn.close()
return [1,None]

else:
conn.disconnect()
conn.close()
return [2,None]

except:
Expand Down

0 comments on commit 898a60b

Please sign in to comment.