summaryrefslogtreecommitdiff
path: root/odoo/tools
diff options
context:
space:
mode:
authorDharmraj Jhala <dja@odoo.com>2020-06-17 11:55:25 +0000
committerDharmraj Jhala <dja@odoo.com>2020-06-17 14:19:09 +0000
commit5af661da7d62605127566124bf5f0e2ee84432db (patch)
treedb7537be7dee1bd7ed2d22159887ef9c6b3ddf75 /odoo/tools
parent0871c10717d641af141973d25e0cddf4cc0c1463 (diff)
[FIX] tools: fix tool method to check empty html content
Since a recent commit[1], we have a utility method in tools named 'is_html_empty' that checks whether the given html content is void(containing only formatting tags) or not. However, the re from this method does not consider the case of self closing tags, fox ex `<br/>`. In such cases, the method returns Falsy value even if the content is void. This commit fixes the issue by considering self-closing void tags in the regular expression. commit[1] - https://github.com/odoo/odoo/commit/974f512f5f5d3b9f80a8c3fcde290e4f55cf1230 Task - 2267689 closes odoo/odoo#53167 X-original-commit: 0fd6c9388dc959a9b6b7828850683175edb05b9d Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'odoo/tools')
-rw-r--r--odoo/tools/mail.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/odoo/tools/mail.py b/odoo/tools/mail.py
index c37f6dcc369..eed992e142f 100644
--- a/odoo/tools/mail.py
+++ b/odoo/tools/mail.py
@@ -276,7 +276,7 @@ def is_html_empty(html_content):
"""
if not html_content:
return True
- tag_re = re.compile(r'\<\s*\/?(?:p|div|span|br|b|i)\s*\>')
+ tag_re = re.compile(r'\<\s*\/?(?:p|div|span|br|b|i)\s*/?\s*\>')
return not bool(re.sub(tag_re, '', html_content).strip())