Пример #1
0
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
Пример #2
0
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
Пример #3
0
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
Пример #4
0
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