We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1d6ea60 commit c3ec719Copy full SHA for c3ec719
1 file changed
src/saml2/server.py
@@ -4,11 +4,11 @@
4
"""Contains classes and functions that a SAML2.0 Identity provider (IdP)
5
or attribute authority (AA) may use to conclude its tasks.
6
"""
7
-import dbm
8
import importlib
9
import logging
10
import shelve
11
import threading
+from dbm import error as DbmError
12
13
from saml2 import BINDING_HTTP_REDIRECT
14
from saml2 import class_name
@@ -58,13 +58,8 @@
58
def _shelve_compat(name, *args, **kwargs):
59
try:
60
return shelve.open(name, *args, **kwargs)
61
- except dbm.error[0]:
62
- # Python 3 whichdb needs to try .db to determine type
63
- if name.endswith(".db"):
64
- name = name.rsplit(".db", 1)[0]
65
- return shelve.open(name, *args, **kwargs)
66
- else:
67
- raise
+ except DbmError:
+ return shelve.open(name.removesuffix(".db"), *args, **kwargs)
68
69
70
class Server(Entity):
0 commit comments