This document is for an old release of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

Source code for galaxy.util.sanitize_html

HTML Sanitizer (lists of acceptable_* ripped from feedparser)
import bleach

from galaxy.util import unicodify

_acceptable_elements = [

_acceptable_attributes = [

[docs]def sanitize_html(htmlSource, allow_data_urls=False): kwd = dict(tags=_acceptable_elements, attributes=_acceptable_attributes, strip=True) if allow_data_urls: kwd["protocols"] = bleach.ALLOWED_PROTOCOLS + ["data"] return bleach.clean(unicodify(htmlSource), **kwd)