diff options
Diffstat (limited to 'src/markupsafe/_native.py')
-rw-r--r-- | src/markupsafe/_native.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/markupsafe/_native.py b/src/markupsafe/_native.py index 801f285..245f03a 100644 --- a/src/markupsafe/_native.py +++ b/src/markupsafe/_native.py @@ -8,8 +8,8 @@ Native Python implementation used when the C module is not compiled. :copyright: © 2010 by the Pallets team. :license: BSD, see LICENSE for more details. """ -from markupsafe import Markup -from markupsafe._compat import text_type +from . import Markup +from ._compat import text_type def escape(s): @@ -23,14 +23,15 @@ def escape(s): :param s: An object to be converted to a string and escaped. :return: A :class:`Markup` string with the escaped text. """ - if hasattr(s, '__html__'): + if hasattr(s, "__html__"): return Markup(s.__html__()) - return Markup(text_type(s) - .replace('&', '&') - .replace('>', '>') - .replace('<', '<') - .replace("'", ''') - .replace('"', '"') + return Markup( + text_type(s) + .replace("&", "&") + .replace(">", ">") + .replace("<", "<") + .replace("'", "'") + .replace('"', """) ) |