[Zope-Checkins] CVS: Zope2 - HTMLClass.py:1.7
shane@digicool.com
shane@digicool.com
Fri, 27 Apr 2001 16:28:28 -0400 (EDT)
Update of /cvs-repository/Zope2/lib/python/StructuredText
In directory korak:/tmp/cvs-serv17686/lib/python/StructuredText
Modified Files:
HTMLClass.py
Log Message:
Merged RestrictedPythonBranch!
--- Updated File HTMLClass.py in package Zope2 --
--- HTMLClass.py 2001/03/20 23:43:23 1.6
+++ HTMLClass.py 2001/04/27 20:27:57 1.7
@@ -84,6 +84,7 @@
##############################################################################
from string import join, split, find
+from cgi import escape
import re, sys, ST
class HTMLClass:
@@ -198,7 +199,7 @@
for c in doc.getChildNodes():
if i==0:
output('<pre>')
- output(html_quote(c.getNodeValue()))
+ output(escape(c.getNodeValue()))
output('</pre>\n')
else:
getattr(self, self.element_types[c.getNodeName()])(
@@ -231,7 +232,7 @@
def literal(self, doc, level, output):
output('<code>')
for c in doc.getChildNodes():
- output(html_quote(c.getNodeValue()))
+ output(escape(c.getNodeValue()))
output('</code>')
def strong(self, doc, level, output):
@@ -300,17 +301,6 @@
output("</tr>\n")
output("</table>\n")
-def html_quote(v, name='(Unknown name)', md={},
- character_entities=(
- (('&'), '&'),
- (('<'), '<' ),
- (('>'), '>' ),
- (('"'), '"'))): #"
- text=str(v)
- for re,name in character_entities:
- if find(text, re) >= 0: text=join(split(text,re),name)
- return text
-