[Python-checkins] CVS: python/dist/src/Lib xmlrpclib.py,1.8,1.9
Skip Montanaro
montanaro@users.sourceforge.net
Mon, 01 Oct 2001 10:50:31 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv25925
Modified Files:
xmlrpclib.py
Log Message:
approximately double dump performance by moving import of cgi.escape back to
top level.
Index: xmlrpclib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/xmlrpclib.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** xmlrpclib.py 2001/09/30 20:15:41 1.8
--- xmlrpclib.py 2001/10/01 17:50:29 1.9
***************
*** 137,140 ****
--- 137,141 ----
import re, string, time, operator
from types import *
+ from cgi import escape as _escape
try:
***************
*** 473,478 ****
def dump_string(self, value):
! from cgi import escape
! self.write("<value><string>%s</string></value>\n" % escape(value))
dispatch[StringType] = dump_string
--- 474,478 ----
def dump_string(self, value):
! self.write("<value><string>%s</string></value>\n" % _escape(value))
dispatch[StringType] = dump_string
***************
*** 480,485 ****
def dump_unicode(self, value):
value = value.encode(self.encoding)
! from cgi import escape
! self.write("<value><string>%s</string></value>\n" % escape(value))
dispatch[UnicodeType] = dump_unicode
--- 480,484 ----
def dump_unicode(self, value):
value = value.encode(self.encoding)
! self.write("<value><string>%s</string></value>\n" % _escape(value))
dispatch[UnicodeType] = dump_unicode
***************
*** 514,519 ****
if type(k) is not StringType:
raise TypeError, "dictionary key must be string"
! from cgi import escape
! write("<name>%s</name>\n" % escape(k))
self.__dump(v)
write("</member>\n")
--- 513,517 ----
if type(k) is not StringType:
raise TypeError, "dictionary key must be string"
! write("<name>%s</name>\n" % _escape(k))
self.__dump(v)
write("</member>\n")