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
...@@ -47,6 +47,7 @@ from shutil import copy ...@@ -47,6 +47,7 @@ from shutil import copy
from zLOG import LOG from zLOG import LOG
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.ERP5.Document.BusinessTemplate import removeAll from Products.ERP5.Document.BusinessTemplate import removeAll
from xml.sax.saxutils import escape
try: try:
...@@ -172,18 +173,6 @@ class DiffFile: ...@@ -172,18 +173,6 @@ class DiffFile:
tmp.append(line) tmp.append(line)
self.children.append(CodeBlock(os.linesep.join(tmp))) 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): def toHTML(self):
# Adding header of the table # Adding header of the table
if self.binary: if self.binary:
...@@ -219,7 +208,7 @@ class DiffFile: ...@@ -219,7 +208,7 @@ class DiffFile:
<td style="background-color: %s">%s</td> <td style="background-color: %s">%s</td>
<td style="background-color: black;" width="2"></td> <td style="background-color: black;" width="2"></td>
<td style="background-color: %s">%s</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> html += ''' </tbody>
</table><br><br>''' </table><br><br>'''
return html 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