Revision: dca59de4c090
Author: Mikko Korpela <[email protected]>
Date: Sun Jun 12 23:43:41 2011
Log: htmlutils: make optimized html_escape a part of the original to
keep interface simple
http://code.google.com/p/robotframework/source/detail?r=dca59de4c090
Modified:
/src/robot/serializing/jsparser.py
/src/robot/utils/__init__.py
/src/robot/utils/htmlutils.py
=======================================
--- /src/robot/serializing/jsparser.py Sun Jun 12 14:23:20 2011
+++ /src/robot/serializing/jsparser.py Sun Jun 12 23:43:41 2011
@@ -413,7 +413,7 @@
if self._is_html:
self._msg += [self._context.get_text_id(text)]
else:
- self._msg +=
[self._context.get_text_id(utils.html_escape_no_formatting_no_whitespace_replace(text))]
+ self._msg +=
[self._context.get_text_id(utils.html_escape(text,
replace_whitespace=False))]
class _RootHandler(_Handler):
=======================================
--- /src/robot/utils/__init__.py Sun Jun 12 14:23:20 2011
+++ /src/robot/utils/__init__.py Sun Jun 12 23:43:41 2011
@@ -19,7 +19,7 @@
from error import (get_error_message, get_error_details, ErrorDetails,
RERAISED_EXCEPTIONS)
from escaping import escape, unescape
-from htmlutils import html_escape, html_attr_escape,
html_escape_no_formatting_no_whitespace_replace
+from htmlutils import html_escape, html_attr_escape
from htmlwriter import HtmlWriter
from idgenerator import IdGenerator, FileNameGenerator
from importing import simple_import, import_
=======================================
--- /src/robot/utils/htmlutils.py Sun Jun 12 14:23:20 2011
+++ /src/robot/utils/htmlutils.py Sun Jun 12 23:43:41 2011
@@ -48,13 +48,15 @@
def html_escape(text, formatting=False, replace_whitespace=True):
+ if not formatting and not replace_whitespace:
+ return _html_escape_no_formatting_no_whitespace_replace(text)
text = unic(text)
formatter = _HtmlStringFormatter(formatting, replace_whitespace)
for line in text.splitlines():
formatter.add(line)
return formatter.result()
-def html_escape_no_formatting_no_whitespace_replace(text):
+def _html_escape_no_formatting_no_whitespace_replace(text):
text = unic(text)
for name, value in [('&', '&'), ('<', '<'), ('>', '>')]:
text = text.replace(name, value)