Skip to content

Commit 1b97237

Browse files
committed
Replace decodestring for decodebytes from base64 module
decodestring has been removed from py39 Signed-off-by: Ivan Kanakarakis <[email protected]>
1 parent b2335fc commit 1b97237

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/saml2/saml.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@
8787
NS_SOAP_ENC = "http://schemas.xmlsoap.org/soap/encoding/"
8888

8989

90-
_b64_decode_fn = getattr(base64, 'decodebytes', base64.decodestring)
91-
_b64_encode_fn = getattr(base64, 'encodebytes', base64.encodestring)
92-
93-
9490
class AttributeValueBase(SamlBase):
9591
def __init__(self,
9692
text=None,
@@ -232,10 +228,9 @@ def _wrong_type_value(xsd, value):
232228
'base64Binary': {
233229
'type': _str,
234230
'to_type': _str,
235-
'to_text': lambda x:
236-
_b64_encode_fn(x.encode())
237-
if base64encode
238-
else x,
231+
'to_text': (
232+
lambda x: base64.encodebytes(x.encode()) if base64encode else x
233+
),
239234
},
240235
'anyType': {
241236
'type': type(value),

0 commit comments

Comments
 (0)