Skip to content

Commit dcadf9e

Browse files
committed
Fix shelve changes in python3
In python3 dbm works a little differently, as does shelve. Adapting the code for behavior instead of python version doesn't seem to work.
1 parent 4878c23 commit dcadf9e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/saml2/eptid.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,7 @@ def get(self, idp, sp, *args):
5858
class EptidShelve(Eptid):
5959
def __init__(self, secret, filename):
6060
Eptid.__init__(self, secret)
61-
self._db = shelve.open(filename, writeback=True)
61+
if six.PY3:
62+
if filename.endswith('.db'):
63+
filename = filename.rsplit('.db', 1)[0]
64+
self._db = shelve.open(filename, writeback=True, protocol=2)

0 commit comments

Comments
 (0)