def __new__(cls, data, escape=True, parent=None): if isinstance(data, Markup): return Markup.__new__(cls, data) elif escape: try: data = safe(data.__html__()) return Markup.__new__(cls, data) except AttributeError: return Markup.__new__(cls, _escape(data)) else: return Markup.__new__(cls, data)
def __new__(cls, base=u'', encoding=None, errors='strict'): if encoding is None and isinstance(base, str): encoding = 'utf8' return jinja2_Markup.__new__(cls, base=base, encoding=encoding, errors=errors)
def __new__(cls, content=u'', preformatted=None): obj = Markup.__new__(cls, content) if preformatted is None: tmp = content.lower() obj._preformatted = not any(tag in tmp for tag in (u'<p>', u'<p ', u'<br', u'<li>')) else: obj._preformatted = preformatted return obj
def __new__(cls, content=u"", preformatted=None): obj = Markup.__new__(cls, content) if preformatted is None: tmp = content.lower() obj._preformatted = not any(tag in tmp for tag in (u"<p>", u"<p ", u"<br", u"<li>")) else: obj._preformatted = preformatted return obj
def __new__(cls, content=u'', preformatted=None): obj = Markup.__new__(cls, content) if preformatted is None: tmp = content.lower() obj._preformatted = not any(tag in tmp for tag in (u'<p>', u'<p ', u'<br', u'<li>')) else: obj._preformatted = preformatted return obj
def __new__(cls, base=u'', encoding=None, errors='strict'): """Add encoding for base of type str.""" if encoding is None and isinstance(base, str): encoding = 'utf8' warnings.warn( "Convert string '{0}' in template to unicode.".format(base), RuntimeWarning, stacklevel=3) return jinja2_Markup.__new__(cls, base=base, encoding=encoding, errors=errors)
def __new__(cls, base=u'', encoding=None, errors='strict'): """Add encoding for base of type str.""" if encoding is None and isinstance(base, str): encoding = 'utf8' warnings.warn( "Convert string '{0}' in template to unicode.".format(base), RuntimeWarning, stacklevel=3) return jinja2_Markup.__new__(cls, base=base, encoding=encoding, errors=errors)
def __new__(cls, base=u'', encoding=None, errors='strict'): if encoding is None and isinstance(base, str): encoding = 'utf8' return jinja2_Markup.__new__(cls, base=base, encoding=encoding, errors=errors)