diff --git a/frappe/utils/html_utils.py b/frappe/utils/html_utils.py index bcc3f70f93..81e5f2de3e 100644 --- a/frappe/utils/html_utils.py +++ b/frappe/utils/html_utils.py @@ -2,11 +2,12 @@ from __future__ import unicode_literals import frappe import json import re -import bleach import bleach_whitelist.bleach_whitelist as bleach_whitelist from six import string_types def clean_html(html): + import bleach + if not isinstance(html, string_types): return html @@ -18,6 +19,8 @@ def clean_html(html): strip=True, strip_comments=True) def clean_email_html(html): + import bleach + if not isinstance(html, string_types): return html @@ -54,6 +57,7 @@ def sanitize_html(html, linkify=False): Does not sanitize JSON, as it could lead to future problems """ + import bleach from bs4 import BeautifulSoup if not isinstance(html, string_types):