PYTHON-2702 Remove deprecated URI options (#710)

This commit is contained in:
Prashant Mital 2021-08-20 10:17:06 -07:00 committed by GitHub
parent b3118e034e
commit 9055bb09e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 32 deletions

View File

@ -89,29 +89,34 @@ The old option names and their renamed equivalents are summarized in the table
below. Some renamed options have different semantics from the option being
replaced as noted in the 'Migration Notes' column.
+--------------------+-------------------------------+-------------------------------------------------------------+
| Old URI Option | Renamed URI Option | Migration Notes |
+====================+===============================+=============================================================+
| ssl_pem_passphrase | tlsCertificateKeyFilePassword | - |
+--------------------+-------------------------------+-------------------------------------------------------------+
| ssl_ca_certs | tlsCAFile | - |
+--------------------+-------------------------------+-------------------------------------------------------------+
| ssl_crlfile | tlsCRLFile | - |
+--------------------+-------------------------------+-------------------------------------------------------------+
| ssl_match_hostname | tlsAllowInvalidHostnames | ``ssl_match_hostname=True`` is equivalent to |
| | | ``tlsAllowInvalidHostnames=False`` and vice-versa. |
+--------------------+-------------------------------+-------------------------------------------------------------+
| ssl_cert_reqs | tlsAllowInvalidCertificates | Instead of ``ssl.CERT_NONE``, ``ssl.CERT_OPTIONAL`` |
| | | and ``ssl.CERT_REQUIRED``, ``tlsAllowInvalidCertificates`` |
| | | expects a boolean value - ``True`` is equivalent to |
| | | ``ssl.CERT_NONE``, while ``False`` is equivalent to |
| | | ``ssl.CERT_REQUIRED``. |
+--------------------+-------------------------------+-------------------------------------------------------------+
| ssl_certfile | tlsCertificateKeyFile | Instead of using ``ssl_certfile`` and ``ssl_keyfile`` |
| | | to specify the certificate and private key files, |
+--------------------+ | ``tlsCertificateKeyFile`` expects a single file containing |
| ssl_keyfile | | both the client certificate and the private key. |
+--------------------+-------------------------------+-------------------------------------------------------------+
+--------------------+-------------------------------+--------------------------------------------------------+
| Old URI Option | Renamed URI Option | Migration Notes |
+====================+===============================+========================================================+
| ssl_pem_passphrase | tlsCertificateKeyFilePassword | - |
+--------------------+-------------------------------+--------------------------------------------------------+
| ssl_ca_certs | tlsCAFile | - |
+--------------------+-------------------------------+--------------------------------------------------------+
| ssl_crlfile | tlsCRLFile | - |
+--------------------+-------------------------------+--------------------------------------------------------+
| ssl_match_hostname | tlsAllowInvalidHostnames | ``ssl_match_hostname=True`` is equivalent to |
| | | ``tlsAllowInvalidHostnames=False`` and vice-versa. |
+--------------------+-------------------------------+--------------------------------------------------------+
| ssl_cert_reqs | tlsAllowInvalidCertificates | Instead of ``ssl.CERT_NONE``, ``ssl.CERT_OPTIONAL`` |
| | | and ``ssl.CERT_REQUIRED``, the new option expects |
| | | a boolean value - ``True`` is equivalent to |
| | | ``ssl.CERT_NONE``, while ``False`` is equivalent to |
| | | ``ssl.CERT_REQUIRED``. |
+--------------------+-------------------------------+--------------------------------------------------------+
| ssl_certfile | tlsCertificateKeyFile | Instead of using ``ssl_certfile`` and ``ssl_keyfile`` |
| | | to specify the certificate and private key files |
+--------------------+ | respectively, use ``tlsCertificateKeyFile`` to pass |
| ssl_keyfile | | a single file containing both the client certificate |
| | | and the private key. |
+--------------------+-------------------------------+--------------------------------------------------------+
| j | journal | - |
+--------------------+-------------------------------+--------------------------------------------------------+
| wtimeout | wTimeoutMS | - |
+--------------------+-------------------------------+--------------------------------------------------------+
MongoClient.fsync is removed
............................

View File

@ -585,8 +585,6 @@ def validate_tzinfo(dummy, value):
# Dictionary where keys are the names of public URI options, and values
# are lists of aliases for that option.
URI_OPTIONS_ALIAS_MAP = {
'journal': ['j'],
'wtimeoutms': ['wtimeout'],
'tls': ['ssl'],
}
@ -666,8 +664,6 @@ KW_VALIDATORS = {
# variant need not be included here. Options whose public and internal
# names are the same need not be included here.
INTERNAL_URI_OPTION_NAME_MAP = {
'j': 'journal',
'wtimeout': 'wtimeoutms',
'ssl': 'tls',
}
@ -681,8 +677,8 @@ URI_OPTIONS_DEPRECATION_MAP = {
# preserved for renamed options as they are part of user warnings.
# - 'removed': <message> may suggest the rationale for deprecating the
# option and/or recommend remedial action.
'j': ('renamed', 'journal'),
'wtimeout': ('renamed', 'wTimeoutMS'),
# For example:
# 'wtimeout': ('renamed', 'wTimeoutMS'),
}
# Augment the option validator map with pymongo-specific option information.

View File

@ -110,7 +110,7 @@ class TestCommon(IntegrationTest):
c = rs_or_single_client(connect=False)
self.assertEqual(WriteConcern(), c.write_concern)
c = rs_or_single_client(connect=False, w=2, wtimeout=1000)
c = rs_or_single_client(connect=False, w=2, wTimeoutMS=1000)
wc = WriteConcern(w=2, wtimeout=1000)
self.assertEqual(wc, c.write_concern)

View File

@ -476,8 +476,8 @@ class TestURI(unittest.TestCase):
def test_normalize_options(self):
# check that options are converted to their internal names correctly.
uri = ("mongodb://example.com/?ssl=true&appname=myapp&wtimeout=10")
res = {"tls": True, "appname": "myapp", "wtimeoutms": 10}
uri = ("mongodb://example.com/?ssl=true&appname=myapp")
res = {"tls": True, "appname": "myapp"}
self.assertEqual(res, parse_uri(uri)["options"])
def test_unquote_after_parsing(self):