summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe <giuseppe.demarco@unical.it>2019-04-26 09:55:24 +0200
committerGiuseppe <giuseppe.demarco@unical.it>2019-04-26 10:52:11 +0200
commit66f912c3a0ac65e97b9e6409539bfab4b3cc7447 (patch)
treeff826f099cf39abdf42d437dda70639e05c70b3f
parent79b9f30b4b76b95be83a7bbe391f1e35150dc17d (diff)
downloadpysaml2-66f912c3a0ac65e97b9e6409539bfab4b3cc7447.tar.gz
DeprecationWarning: cgi.escape is deprecated, use html.escape instead. Fixed
-rw-r--r--src/saml2/pack.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/saml2/pack.py b/src/saml2/pack.py
index b447be31..cad55dfb 100644
--- a/src/saml2/pack.py
+++ b/src/saml2/pack.py
@@ -8,7 +8,10 @@ Bindings normally consists of three parts:
"""
import base64
-import cgi
+# [DeprecationWarning] Fixed: cgi.escape is deprecated, use html.escape instead
+try: import html
+except: import cgi as html
+
import logging
import saml2
@@ -87,15 +90,15 @@ def http_form_post_message(message, location, relay_state="",
_msg = _msg.decode('ascii')
saml_response_input = HTML_INPUT_ELEMENT_SPEC.format(
- name=cgi.escape(typ),
- val=cgi.escape(_msg),
+ name=html.escape(typ),
+ val=html.escape(_msg),
type='hidden')
relay_state_input = ""
if relay_state:
relay_state_input = HTML_INPUT_ELEMENT_SPEC.format(
name='RelayState',
- val=cgi.escape(relay_state),
+ val=html.escape(relay_state),
type='hidden')
response = HTML_FORM_SPEC.format(