def to_text(html): try: html = unicode(html) except UnicodeDecodeError: pass key = '%s:to_text' % hash(html) out = cache.get(key, namespace="filters") if not out: out = api.remove_html_tags(html) cache.set(key, out, namespace="filters") return out
def _convert_to_text(html): try: html = unicode(html) except UnicodeDecodeError: pass key = '%s:convert_to_text' % hash(html) out = cache.get(key, namespace="filters") if not out: html = fix_unclosed_tags(html) plain_text = api.remove_html_tags(html) cache.set(key, out, namespace="filters") return out