Browse Source

PEEK-1041 Fixed the deprecated 'cgi.escape()'

main
Louis Lu 3 years ago
parent
commit
c81c69833c
3 changed files with 8 additions and 10 deletions
  1. +3
    -3
      src/SOAPpy/SOAPBuilder.py
  2. +2
    -2
      src/SOAPpy/Types.py
  3. +3
    -5
      tools/interop2html.py

+ 3
- 3
src/SOAPpy/SOAPBuilder.py View File

@@ -32,11 +32,11 @@
#
################################################################################
"""
import html

ident = '$Id: SOAPBuilder.py 1498 2010-03-12 02:13:19Z pooryorick $'
from .version import __version__

import cgi
from wstools.XMLname import toXMLname, fromXMLname

# SOAPpy-py3 modules
@@ -313,7 +313,7 @@ class SOAPBuilder:
try: data = obj._marshalData()
except:
if (obj_type != "string"): # strings are already encoded
data = cgi.escape(str(obj))
data = html.escape(str(obj))
else:
data = obj

@@ -373,7 +373,7 @@ class SOAPBuilder:
try: data = obj._marshalData()
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))

dump_str = dump_string # For Python 2.2+


+ 2
- 2
src/SOAPpy/Types.py View File

@@ -50,9 +50,9 @@ InstanceType = object
ident = '$Id: Types.py 1496 2010-03-04 23:46:17Z pooryorick $'
from .version import __version__

import html
import collections
import base64
import cgi
import urllib.request, urllib.parse, urllib.error
import copy
import re
@@ -123,7 +123,7 @@ class anyType:
for attr, value in list(self._attrs.items()):
ns, n = builder.genns(ns_map, attr[0])
a += n + ' %s%s="%s"' % \
(ns, attr[1], cgi.escape(str(value), 1))
(ns, attr[1], html.escape(str(value), 1))

return a



+ 3
- 5
tools/interop2html.py View File

@@ -1,7 +1,5 @@
#!/usr/bin/env python

import string
import cgi
import html

ident = '$Id: interop2html.py 4 2001-06-27 21:36:11Z cullman $'

@@ -62,12 +60,12 @@ while c < totalmethods:
elif status.find("expected") != -1:
bgcolor = "#FF9900"
hreftitle = table[key][i][1][1].replace("'","") # remove apostrophes from title properties
popuphtml = '"' + cgi.escape(cgi.escape(table[key][i][1][1]).replace("'","&#39;").replace('"',"&#34;")) + '"'
popuphtml = '"' + html.escape(html.escape(table[key][i][1][1]).replace("'","&#39;").replace('"',"&#34;")) + '"'
status = "<a title='" + hreftitle + "' href='javascript:popup(" + popuphtml + ")'>Failed (expected)</a>"
else:
bgcolor = "#CC0000"
hreftitle = table[key][i][1][1].replace("'","") # remove apostrophes from title properties
popuphtml = '"' + cgi.escape(cgi.escape(table[key][i][1][1]).replace("'","&#39;").replace('"',"&#34;")) + '"'
popuphtml = '"' + html.escape(html.escape(table[key][i][1][1]).replace("'","&#39;").replace('"',"&#34;")) + '"'
status = "<a title='" + hreftitle + "' href='javascript:popup(" + popuphtml + ")'>Failed</a>"
print("<td align='center' bgcolor=" , bgcolor , ">" , status , "</td>")
print("</tr>")


Loading…
Cancel
Save