Commit e3374c1f authored by Christophe Dumez's avatar Christophe Dumez

- do not duplicate escape function anymore, use the one in xml.sax.saxutils

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7191 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 83ed054f
No related merge requests found
......@@ -47,6 +47,7 @@ from shutil import copy
from zLOG import LOG
from Products.CMFCore.utils import getToolByName
from Products.ERP5.Document.BusinessTemplate import removeAll
from xml.sax.saxutils import escape
try:
......@@ -172,18 +173,6 @@ class DiffFile:
tmp.append(line)
self.children.append(CodeBlock(os.linesep.join(tmp)))
def _escape(self, data):
"""
Escape &, <, and > in a string of data.
This is a copy of the xml.sax.saxutils.escape function.
"""
if data:
#data = data.replace("&", "&amp;")
data = data.replace(">", "&gt;")
data = data.replace("<", "&lt;")
return data
def toHTML(self):
# Adding header of the table
if self.binary:
......@@ -219,7 +208,7 @@ class DiffFile:
<td style="background-color: %s">%s</td>
<td style="background-color: black;" width="2"></td>
<td style="background-color: %s">%s</td>
</tr>'''%(old_line_tuple[1], self._escape(old_line).replace(' ', '&nbsp;').replace('\t', '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'), new_line_tuple[1], self._escape(new_line).replace(' ', '&nbsp;').replace('\t', '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'))
</tr>'''%(old_line_tuple[1], escape(old_line).replace(' ', '&nbsp;').replace('\t', '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'), new_line_tuple[1], escape(new_line).replace(' ', '&nbsp;').replace('\t', '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'))
html += ''' </tbody>
</table><br><br>'''
return html
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment