From 55cb0de1dbbce55297d167335b76f0654124efb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Debauche?= Date: Thu, 14 May 2020 15:25:13 +0000 Subject: [PATCH] [IMP] tools: remove unnecessary lxml Cleaner override Purpose ======= Currently a custom override of Cleaner.allow_element() exists in tools to allow object tags for SVG images. This was due to the first prototype of website builder and its first implementation of image and svg management. This is not necessary anymore as using the tag is sufficient. We can safely clean code in the cleaner, allowing to speedup its performances. As it is used in most html fields and email parsing each unnecessary code removed is time gainged. Task 2215228 closes odoo/odoo#51294 X-original-commit: 4a0b09fd3b0d3b63f2df00f002e4d6825cac4eef Signed-off-by: Thibault Delavallee (tde) Signed-off-by: Martin Trigaux (mat) --- odoo/tools/mail.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/odoo/tools/mail.py b/odoo/tools/mail.py index 1a3e9d80b9f..fd40244500c 100644 --- a/odoo/tools/mail.py +++ b/odoo/tools/mail.py @@ -161,11 +161,6 @@ class _Cleaner(clean.Cleaner): else: del el.attrib['style'] - def allow_element(self, el): - if el.tag == 'object' and el.get('type') == "image/svg+xml": - return True - return super(_Cleaner, self).allow_element(el) - def html_sanitize(src, silent=True, sanitize_tags=True, sanitize_attributes=False, sanitize_style=False, sanitize_form=True, strip_style=False, strip_classes=False): if not src: