def __new__(cls, value): allowed_tags = su.DEFAULT_ALLOWED_HTML_TAGS allowed_attrs = { 'a': cls._filter_anchor_attributes, 'abbr': ['title'], 'acronym': ['title'], } value = su.clean_html(value, allowed_tags=allowed_tags, allowed_attrs=allowed_attrs, markup=False) obj = super(UnicodeHTML, cls).__new__(cls, value) return obj
def __new__(cls, value): value = su.clean_html(value, allowed_tags=[], allowed_attrs={}, markup=False) value = su.unescape_entities(value) obj = super(UnicodeNoHTML, cls).__new__(cls, value) return obj
def _serialize(self, value, attr, obj): if value is None: return None return su.clean_html(value, markup=False, allowed_tags=self.allowed_tags, allowed_attrs=self.allowed_attrs)