def utf8escape(s): """ UTF8-8-bit-string-friendly replacement function for MarkupSafe/Jinja2 escape function. WARNING: Do not use this method. Use jinja2.escape() instead. """ if isinstance(s, str): return jinja2_escape(s.decode('utf8')) return jinja2_escape(s)
def utf8escape(s): """UTF8-8-bit-string-friendly replacement for MarkupSafe escape function. WARNING: Do not use this method. Use jinja2.escape() instead. """ if isinstance(s, str): warnings.warn("Convert string '{0}' in template to unicode.".format(s), RuntimeWarning, stacklevel=3) return jinja2_escape(s.decode('utf8')) return jinja2_escape(s)