From 293c1c77e3c1b2da18aa4173086ac2d302d22312 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Sat, 20 Feb 2021 21:18:37 +0530 Subject: [PATCH] perf: Remove bleach from import tree --- frappe/utils/html_utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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):