Use htmlescape. It's simpler and just as fast now ... (quixote/TemplateIO.py)
Neil Schemenauer <nascheme-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]> Wed, 08 Jan 2003 14:40:17 -0500
| Newsgroups | gmane.comp.web.quixote.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /home/cvs/quixote
In directory hewson:/tmp/cvs-serv20015
Modified Files:
TemplateIO.py
Log Message:
Use htmlescape. It's simpler and just as fast now that there's a C
version of it.
Index: TemplateIO.py
===================================================================
RCS file: /home/cvs/quixote/TemplateIO.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- TemplateIO.py 20 Nov 2002 19:43:22 -0000 1.8
+++ TemplateIO.py 8 Jan 2003 19:40:15 -0000 1.9
@@ -1,6 +1,6 @@
__revision__ = "$Id$"
-from html import htmltext
+from html import htmltext, htmlescape
class TemplateIO:
"""Collect output for PTL scripts.
@@ -40,10 +40,4 @@
if template_type == "plain":
return ''.join(map(str, self.data))
else:
- data = []
- for chunk in self.data:
- if type(chunk) is htmltext:
- data.append(str(chunk))
- else:
- data.append(htmltext.quote(str(chunk)))
- return htmltext(''.join(data))
+ return htmltext('').join(map(htmlescape, self.data))