diff --git a/product/ERP5Subversion/Tool/SubversionTool.py b/product/ERP5Subversion/Tool/SubversionTool.py index 402a8cfceb913e4888f5e2a285ac2b74d88484ca..f13942679a58c6ccb323b5dcb62b59c5b8403ba8 100644 --- a/product/ERP5Subversion/Tool/SubversionTool.py +++ b/product/ERP5Subversion/Tool/SubversionTool.py @@ -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("&", "&") - data = data.replace(">", ">") - data = data.replace("<", "<") - 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(' ', ' ').replace('\t', ' '), new_line_tuple[1], self._escape(new_line).replace(' ', ' ').replace('\t', ' ')) + </tr>'''%(old_line_tuple[1], escape(old_line).replace(' ', ' ').replace('\t', ' '), new_line_tuple[1], escape(new_line).replace(' ', ' ').replace('\t', ' ')) html += ''' </tbody> </table><br><br>''' return html