Skip to content

Commit e2bbb37

Browse files
committed
Remove parse_uri()'s conn_max_age parameter
Obsolete as of a643d98.
1 parent a643d98 commit e2bbb37

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

django_mongodb_backend/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def check_django_compatability():
2828
)
2929

3030

31-
def parse_uri(uri, *, db_name=None, conn_max_age=0, test=None):
31+
def parse_uri(uri, *, db_name=None, test=None):
3232
"""
3333
Convert the given uri into a dictionary suitable for Django's DATABASES
3434
setting.
@@ -56,7 +56,6 @@ def parse_uri(uri, *, db_name=None, conn_max_age=0, test=None):
5656
"USER": uri.get("username"),
5757
"PASSWORD": uri.get("password"),
5858
"OPTIONS": uri.get("options"),
59-
"CONN_MAX_AGE": conn_max_age,
6059
}
6160
if "authSource" not in settings_dict["OPTIONS"] and uri["database"]:
6261
settings_dict["OPTIONS"]["authSource"] = uri["database"]

docs/source/ref/utils.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ following parts can be considered stable.
1212
``parse_uri()``
1313
===============
1414

15-
.. function:: parse_uri(uri, db_name=None, conn_max_age=0, test=None)
15+
.. function:: parse_uri(uri, db_name=None, test=None)
1616

1717
Parses a MongoDB `connection string`_ into a dictionary suitable for Django's
1818
:setting:`DATABASES` setting.
@@ -32,8 +32,6 @@ doesn't specify ``defaultauthdb``.
3232
You can use the parameters to customize the resulting :setting:`DATABASES`
3333
setting:
3434

35-
- Use ``conn_max_age`` to configure :ref:`persistent database connections
36-
<persistent-database-connections>`.
3735
- Use ``test`` to provide a dictionary of settings for test databases in the
3836
format of :setting:`TEST <DATABASE-TEST>`.
3937

docs/source/releases/5.2.x.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ Backwards incompatible changes
2727
------------------------------
2828

2929
- The minimum supported version of ``pymongo`` is increased from 4.6 to 4.7.
30+
- The ``conn_max_age`` parameter of
31+
:func:`~django_mongodb_backend.utils.parse_uri` is removed because persistent
32+
connections are now used by default.
3033

3134
Bug fixes
3235
---------

tests/backend_/utils/test_parse_uri.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,6 @@ def test_auth_source_in_query_string_overrides_defaultauthdb(self):
8282
self.assertEqual(settings_dict["NAME"], "db")
8383
self.assertEqual(settings_dict["OPTIONS"], {"authSource": "auth"})
8484

85-
def test_conn_max_age(self):
86-
settings_dict = parse_uri("mongodb://localhost/db", conn_max_age=600)
87-
self.assertEqual(settings_dict["CONN_MAX_AGE"], 600)
88-
8985
def test_test_kwarg(self):
9086
settings_dict = parse_uri("mongodb://localhost/db", test={"NAME": "test_db"})
9187
self.assertEqual(settings_dict["TEST"], {"NAME": "test_db"})

0 commit comments

Comments
 (0)