quixote TemplateIO.py,1.6,1.7
Neil Schemenauer <nascheme-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]>
| Newsgroups | gmane.comp.web.quixote.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /home/cvs/quixote
In directory hewson:/tmp/cvs-serv20278
Modified Files:
TemplateIO.py
Log Message:
Add htmltext support.
Index: TemplateIO.py
===================================================================
RCS file: /home/cvs/quixote/TemplateIO.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- TemplateIO.py 23 Aug 2001 19:08:44 -0000 1.6
+++ TemplateIO.py 14 Oct 2002 22:58:01 -0000 1.7
@@ -1,5 +1,7 @@
__revision__ = "$Id$"
+from html import htmltext
+
class TemplateIO:
"""Collect output for PTL scripts.
@@ -33,3 +35,15 @@
def __repr__(self):
return ("<%s at %x: %d chunks>" %
(self.__class__.__name__, id(self), len(self.data)))
+
+ def getvalue(self, template_type):
+ 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))