Skip to content

Commit c5c7bdf

Browse files
committed
Update URI warning in MongoReplicaSetClient.
1 parent 76b8b40 commit c5c7bdf

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

pymongo/mongo_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,9 @@ def __init__(self, host=None, port=None, max_pool_size=10,
274274
raise ConnectionFailure(str(e))
275275

276276
if db and username is None:
277-
warnings.warn("database name in URI is being ignored. if you wish to authenticate to %s, "
278-
"you must provide a username and password" % (db,))
277+
warnings.warn("database name in URI is being ignored. If you wish "
278+
"to authenticate to %s, you must provide a username "
279+
"and password." % (db,))
279280
if username:
280281
db = db or "admin"
281282
if not self[db].authenticate(username, password):

pymongo/mongo_replica_set_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,9 @@ def __init__(self, hosts_or_uri=None, max_pool_size=10,
433433
raise ConnectionFailure(str(e))
434434

435435
if db_name and username is None:
436-
warnings.warn("must provide a username and password "
437-
"to authenticate to %s" % (db_name,))
436+
warnings.warn("database name in URI is being ignored. If you wish "
437+
"to authenticate to %s, you must provide a username "
438+
"and password." % (db_name,))
438439
if username:
439440
db_name = db_name or 'admin'
440441
if not self[db_name].authenticate(username, password):

0 commit comments

Comments
 (0)