PEEK-1041 Fixed the deprecated 'cgi.escape()' See merge request peek/util/soappy-py3!1main
| @@ -32,11 +32,11 @@ | |||||
| # | # | ||||
| ################################################################################ | ################################################################################ | ||||
| """ | """ | ||||
| import html | |||||
| ident = '$Id: SOAPBuilder.py 1498 2010-03-12 02:13:19Z pooryorick $' | ident = '$Id: SOAPBuilder.py 1498 2010-03-12 02:13:19Z pooryorick $' | ||||
| from .version import __version__ | from .version import __version__ | ||||
| import cgi | |||||
| from wstools.XMLname import toXMLname, fromXMLname | from wstools.XMLname import toXMLname, fromXMLname | ||||
| # SOAPpy-py3 modules | # SOAPpy-py3 modules | ||||
| @@ -313,7 +313,7 @@ class SOAPBuilder: | |||||
| try: data = obj._marshalData() | try: data = obj._marshalData() | ||||
| except: | except: | ||||
| if (obj_type != "string"): # strings are already encoded | if (obj_type != "string"): # strings are already encoded | ||||
| data = cgi.escape(str(obj)) | |||||
| data = html.escape(str(obj)) | |||||
| else: | else: | ||||
| data = obj | data = obj | ||||
| @@ -373,7 +373,7 @@ class SOAPBuilder: | |||||
| try: data = obj._marshalData() | try: data = obj._marshalData() | ||||
| except: data = obj | except: data = obj | ||||
| self.out.append(self.dumper(None, "string", cgi.escape(data), tag, | |||||
| self.out.append(self.dumper(None, "string", html.escape(data), tag, | |||||
| typed, ns_map, self.genroot(ns_map), id)) | typed, ns_map, self.genroot(ns_map), id)) | ||||
| dump_str = dump_string # For Python 2.2+ | dump_str = dump_string # For Python 2.2+ | ||||
| @@ -50,9 +50,9 @@ InstanceType = object | |||||
| ident = '$Id: Types.py 1496 2010-03-04 23:46:17Z pooryorick $' | ident = '$Id: Types.py 1496 2010-03-04 23:46:17Z pooryorick $' | ||||
| from .version import __version__ | from .version import __version__ | ||||
| import html | |||||
| import collections | import collections | ||||
| import base64 | import base64 | ||||
| import cgi | |||||
| import urllib.request, urllib.parse, urllib.error | import urllib.request, urllib.parse, urllib.error | ||||
| import copy | import copy | ||||
| import re | import re | ||||
| @@ -123,7 +123,7 @@ class anyType: | |||||
| for attr, value in list(self._attrs.items()): | for attr, value in list(self._attrs.items()): | ||||
| ns, n = builder.genns(ns_map, attr[0]) | ns, n = builder.genns(ns_map, attr[0]) | ||||
| a += n + ' %s%s="%s"' % \ | a += n + ' %s%s="%s"' % \ | ||||
| (ns, attr[1], cgi.escape(str(value), 1)) | |||||
| (ns, attr[1], html.escape(str(value), 1)) | |||||
| return a | return a | ||||
| @@ -1,7 +1,5 @@ | |||||
| #!/usr/bin/env python | #!/usr/bin/env python | ||||
| import string | |||||
| import cgi | |||||
| import html | |||||
| ident = '$Id: interop2html.py 4 2001-06-27 21:36:11Z cullman $' | ident = '$Id: interop2html.py 4 2001-06-27 21:36:11Z cullman $' | ||||
| @@ -62,12 +60,12 @@ while c < totalmethods: | |||||
| elif status.find("expected") != -1: | elif status.find("expected") != -1: | ||||
| bgcolor = "#FF9900" | bgcolor = "#FF9900" | ||||
| hreftitle = table[key][i][1][1].replace("'","") # remove apostrophes from title properties | hreftitle = table[key][i][1][1].replace("'","") # remove apostrophes from title properties | ||||
| popuphtml = '"' + cgi.escape(cgi.escape(table[key][i][1][1]).replace("'","'").replace('"',""")) + '"' | |||||
| popuphtml = '"' + html.escape(html.escape(table[key][i][1][1]).replace("'","'").replace('"',""")) + '"' | |||||
| status = "<a title='" + hreftitle + "' href='javascript:popup(" + popuphtml + ")'>Failed (expected)</a>" | status = "<a title='" + hreftitle + "' href='javascript:popup(" + popuphtml + ")'>Failed (expected)</a>" | ||||
| else: | else: | ||||
| bgcolor = "#CC0000" | bgcolor = "#CC0000" | ||||
| hreftitle = table[key][i][1][1].replace("'","") # remove apostrophes from title properties | hreftitle = table[key][i][1][1].replace("'","") # remove apostrophes from title properties | ||||
| popuphtml = '"' + cgi.escape(cgi.escape(table[key][i][1][1]).replace("'","'").replace('"',""")) + '"' | |||||
| popuphtml = '"' + html.escape(html.escape(table[key][i][1][1]).replace("'","'").replace('"',""")) + '"' | |||||
| status = "<a title='" + hreftitle + "' href='javascript:popup(" + popuphtml + ")'>Failed</a>" | status = "<a title='" + hreftitle + "' href='javascript:popup(" + popuphtml + ")'>Failed</a>" | ||||
| print("<td align='center' bgcolor=" , bgcolor , ">" , status , "</td>") | print("<td align='center' bgcolor=" , bgcolor , ">" , status , "</td>") | ||||
| print("</tr>") | print("</tr>") | ||||