summaryrefslogtreecommitdiffstats
path: root/Lib/xmlrpclib.py
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2007-04-17 08:42:15 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2007-04-17 08:42:15 (GMT)
commitff11334927ee616d765b54a3851016b76a20bcec (patch)
tree30968506e7cf62f8a8960788a4fe6a509da51006 /Lib/xmlrpclib.py
parent53855c6495b076143c7bf947817fc967e3068af2 (diff)
downloadcpython-ff11334927ee616d765b54a3851016b76a20bcec.zip
cpython-ff11334927ee616d765b54a3851016b76a20bcec.tar.gz
cpython-ff11334927ee616d765b54a3851016b76a20bcec.tar.bz2
Remove the SlowParser class because it depended on the xmllib module
which was removed. Use string methods rather than the string module.
Diffstat (limited to 'Lib/xmlrpclib.py')
-rw-r--r--Lib/xmlrpclib.py41
1 files changed, 11 insertions, 30 deletions
diff --git a/Lib/xmlrpclib.py b/Lib/xmlrpclib.py
index 4941001..784b3c9 100644
--- a/Lib/xmlrpclib.py
+++ b/Lib/xmlrpclib.py
@@ -136,7 +136,7 @@ Exported functions:
name (None if not present).
"""
-import re, string, time, operator
+import re, time, operator
from types import *
@@ -164,10 +164,10 @@ def _decode(data, encoding, is8bit=re.compile("[\x80-\xff]").search):
data = unicode(data, encoding)
return data
-def escape(s, replace=string.replace):
- s = replace(s, "&", "&amp;")
- s = replace(s, "<", "&lt;")
- return replace(s, ">", "&gt;",)
+def escape(s):
+ s = s.replace("&", "&amp;")
+ s = s.replace("<", "&lt;")
+ return s.replace(">", "&gt;",)
if unicode:
def _stringify(string):
@@ -346,8 +346,7 @@ class DateTime:
return "<DateTime %s at %x>" % (repr(self.value), id(self))
def decode(self, data):
- data = str(data)
- self.value = string.strip(data)
+ self.value = str(data).strip()
def encode(self, out):
out.write("<value><dateTime.iso8601>")
@@ -513,24 +512,6 @@ else:
self._parser.Parse("", 1) # end of data
del self._target, self._parser # get rid of circular references
-class SlowParser:
- """Default XML parser (based on xmllib.XMLParser)."""
- # this is about 10 times slower than sgmlop, on roundtrip
- # testing.
- def __init__(self, target):
- import xmllib # lazy subclassing (!)
- if xmllib.XMLParser not in SlowParser.__bases__:
- SlowParser.__bases__ = (xmllib.XMLParser,)
- self.handle_xml = target.xml
- self.unknown_starttag = target.start
- self.handle_data = target.data
- self.handle_cdata = target.data
- self.unknown_endtag = target.end
- try:
- xmllib.XMLParser.__init__(self, accept_utf8=1)
- except TypeError:
- xmllib.XMLParser.__init__(self) # pre-2.0
-
# --------------------------------------------------------------------
# XML-RPC marshalling and unmarshalling code
@@ -586,7 +567,7 @@ class Marshaller:
dump(v, write)
write("</param>\n")
write("</params>\n")
- result = string.join(out, "")
+ result = "".join(out)
return result
def __dump(self, value, write):
@@ -786,14 +767,14 @@ class Unmarshaller:
def data(self, text):
self._data.append(text)
- def end(self, tag, join=string.join):
+ def end(self, tag):
# call the appropriate end tag handler
try:
f = self.dispatch[tag]
except KeyError:
pass # unknown tag ?
else:
- return f(self, join(self._data, ""))
+ return f(self, "".join(self._data))
#
# accelerator support
@@ -1085,7 +1066,7 @@ def dumps(params, methodname=None, methodresponse=None, encoding=None,
)
else:
return data # return as is
- return string.join(data, "")
+ return "".join(data)
##
# Convert an XML-RPC packet to a Python object. If the XML-RPC packet
@@ -1210,7 +1191,7 @@ class Transport:
if auth:
import base64
auth = base64.encodestring(urllib.unquote(auth))
- auth = string.join(string.split(auth), "") # get rid of whitespace
+ auth = "".join(auth.split()) # get rid of whitespace
extra_headers = [
("Authorization", "Basic " + auth)
]