Skip to content

Commit 66f912c

Browse files
committed
DeprecationWarning: cgi.escape is deprecated, use html.escape instead. Fixed
1 parent 79b9f30 commit 66f912c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/saml2/pack.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
"""
99

1010
import base64
11-
import cgi
11+
# [DeprecationWarning] Fixed: cgi.escape is deprecated, use html.escape instead
12+
try: import html
13+
except: import cgi as html
14+
1215
import logging
1316

1417
import saml2
@@ -87,15 +90,15 @@ def http_form_post_message(message, location, relay_state="",
8790
_msg = _msg.decode('ascii')
8891

8992
saml_response_input = HTML_INPUT_ELEMENT_SPEC.format(
90-
name=cgi.escape(typ),
91-
val=cgi.escape(_msg),
93+
name=html.escape(typ),
94+
val=html.escape(_msg),
9295
type='hidden')
9396

9497
relay_state_input = ""
9598
if relay_state:
9699
relay_state_input = HTML_INPUT_ELEMENT_SPEC.format(
97100
name='RelayState',
98-
val=cgi.escape(relay_state),
101+
val=html.escape(relay_state),
99102
type='hidden')
100103

101104
response = HTML_FORM_SPEC.format(

0 commit comments

Comments
 (0)