diff options
author | Skip Montanaro <skip@pobox.com> | 2001-10-01 17:50:29 (GMT) |
---|---|---|
committer | Skip Montanaro <skip@pobox.com> | 2001-10-01 17:50:29 (GMT) |
commit | fbacaf7298fe9118d1c41b11de7449729ecc0bcd (patch) | |
tree | 20669a0a088b5baa53f9f02884650ea2c5cc0292 /Lib/xmlrpclib.py | |
parent | 419abdaff2f7d9e773c11754fe8966d689bbb833 (diff) | |
download | cpython-fbacaf7298fe9118d1c41b11de7449729ecc0bcd.zip cpython-fbacaf7298fe9118d1c41b11de7449729ecc0bcd.tar.gz cpython-fbacaf7298fe9118d1c41b11de7449729ecc0bcd.tar.bz2 |
approximately double dump performance by moving import of cgi.escape back to
top level.
Diffstat (limited to 'Lib/xmlrpclib.py')
-rw-r--r-- | Lib/xmlrpclib.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Lib/xmlrpclib.py b/Lib/xmlrpclib.py index ea4f932..37c9429 100644 --- a/Lib/xmlrpclib.py +++ b/Lib/xmlrpclib.py @@ -136,6 +136,7 @@ Exported functions: import re, string, time, operator from types import * +from cgi import escape as _escape try: unicode @@ -472,15 +473,13 @@ class Marshaller: dispatch[FloatType] = dump_double def dump_string(self, value): - from cgi import escape - self.write("<value><string>%s</string></value>\n" % escape(value)) + self.write("<value><string>%s</string></value>\n" % _escape(value)) dispatch[StringType] = dump_string if unicode: def dump_unicode(self, value): value = value.encode(self.encoding) - from cgi import escape - self.write("<value><string>%s</string></value>\n" % escape(value)) + self.write("<value><string>%s</string></value>\n" % _escape(value)) dispatch[UnicodeType] = dump_unicode def container(self, value): @@ -513,8 +512,7 @@ class Marshaller: write("<member>\n") if type(k) is not StringType: raise TypeError, "dictionary key must be string" - from cgi import escape - write("<name>%s</name>\n" % escape(k)) + write("<name>%s</name>\n" % _escape(k)) self.__dump(v) write("</member>\n") write("</struct></value>\n") |