From 436daf0c4f22bd6cb8d761d2eaae7a9ae764a724 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Thu, 27 Aug 2015 18:00:18 +0200 Subject: [PATCH] [FIX] tools: lxml.etree.XMLSyntaxError if html is empty Don't try to parse html as xml if html is empty --- openerp/tools/mail.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openerp/tools/mail.py b/openerp/tools/mail.py index b825e3cffdb..92af711dc94 100644 --- a/openerp/tools/mail.py +++ b/openerp/tools/mail.py @@ -475,6 +475,10 @@ def html2plaintext(html, body_id=None, encoding='utf-8'): ## download here: http://www.peterbe.com/plog/html2plaintext html = ustr(html) + + if not html: + return '' + tree = etree.fromstring(html, parser=etree.HTMLParser()) if body_id is not None: