forked from pool/python-pysaml2
- Add patch pymongo-4-support.patch:
* Support pymongo >= 4 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pysaml2?expand=0&rev=63
This commit is contained in:
37
pymongo-4-support.patch
Normal file
37
pymongo-4-support.patch
Normal file
@@ -0,0 +1,37 @@
|
||||
From 32a3c24ae1292ad04065aaaee6324ab9441fad8e Mon Sep 17 00:00:00 2001
|
||||
From: Johan Lundberg <lundberg@sunet.se>
|
||||
Date: Wed, 8 Dec 2021 15:10:27 +0100
|
||||
Subject: [PATCH] MongoReplicaSetClient removed in pymongo>=4
|
||||
|
||||
from pymongo docs:
|
||||
Since PyMongo 3.0, MongoReplicaSetClient has been identical to
|
||||
pymongo.mongo_client.MongoClient. Applications can simply replace
|
||||
MongoReplicaSetClient with pymongo.mongo_client.MongoClient and get the
|
||||
same behavior.
|
||||
---
|
||||
src/saml2/mongo_store.py | 5 +----
|
||||
1 file changed, 1 insertion(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/saml2/mongo_store.py b/src/saml2/mongo_store.py
|
||||
index 7df1b5655..d7f834d1b 100644
|
||||
--- a/src/saml2/mongo_store.py
|
||||
+++ b/src/saml2/mongo_store.py
|
||||
@@ -2,8 +2,7 @@
|
||||
from hashlib import sha1
|
||||
import logging
|
||||
|
||||
-from pymongo import MongoClient
|
||||
-from pymongo.mongo_replica_set_client import MongoReplicaSetClient
|
||||
+from pymongo.mongo_client import MongoClient
|
||||
import pymongo.uri_parser
|
||||
import pymongo.errors
|
||||
from saml2.saml import NAMEID_FORMAT_PERSISTENT
|
||||
@@ -288,8 +287,6 @@ def _mdb_get_database(uri, **kwargs):
|
||||
_conn = MongoClient()
|
||||
pass
|
||||
else:
|
||||
- if "replicaset" in _parsed_uri["options"]:
|
||||
- connection_factory = MongoReplicaSetClient
|
||||
db_name = _parsed_uri.get("database", "pysaml2")
|
||||
_conn = connection_factory(uri, **kwargs)
|
||||
|
Reference in New Issue
Block a user