[Python-checkins] python/dist/src/Lib/xml/sax saxutils.py,1.17,1.18
fdrake@users.sourceforge.net
fdrake@users.sourceforge.net
Mon, 28 Oct 2002 09:29:05 -0800
Update of /cvsroot/python/python/dist/src/Lib/xml/sax
In directory usw-pr-cvs1:/tmp/cvs-serv20493
Modified Files:
saxutils.py
Log Message:
Avoid calling __dict_replace() if we don't need to -- the call is much
more expensive than just doing to work needed, and these things seem
to always turn into a bottleneck eventually.
Index: saxutils.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/saxutils.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** saxutils.py 26 Oct 2002 14:50:45 -0000 1.17
--- saxutils.py 28 Oct 2002 17:29:01 -0000 1.18
***************
*** 29,36 ****
# must do ampersand first
data = data.replace("&", "&")
! data = __dict_replace(data, {"<" : "<",
! ">" : ">",
! })
! return __dict_replace(data, entities)
def unescape(data, entities={}):
--- 29,37 ----
# must do ampersand first
data = data.replace("&", "&")
! data = data.replace(">", ">")
! data = data.replace("<", "<")
! if entities:
! data = __dict_replace(data, entities)
! return data
def unescape(data, entities={}):
***************
*** 41,50 ****
strings; each key will be replaced with its corresponding value.
"""
! data = __dict_replace(data, {"<" : "<",
! ">" : ">",
! })
# must do ampersand last
data = data.replace("&", "&")
! return __dict_replace(data, entities)
def quoteattr(data, entities={}):
--- 42,52 ----
strings; each key will be replaced with its corresponding value.
"""
! data = data.replace("<", "<")
! data = data.replace(">", ">")
# must do ampersand last
data = data.replace("&", "&")
! if entities:
! data = __dict_replace(data, entities)
! return data
def quoteattr(data, entities={}):