From 6072e586f4fabd6d2193d8de0fe7a3ca24465cae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 15 Jan 2014 16:16:44 +0100 Subject: [PATCH] [FIX] website_mail: email_template: fixed lxml/etree adding a div outside of the html content, breaking the snippets-based editor. bzr revid: tde@openerp.com-20140115151644-0cei3chdl5op2flr --- addons/website_mail/models/email_template.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/website_mail/models/email_template.py b/addons/website_mail/models/email_template.py index 720ac8bfb0e..aed01c179f7 100644 --- a/addons/website_mail/models/email_template.py +++ b/addons/website_mail/models/email_template.py @@ -73,7 +73,10 @@ class EmailTemplate(osv.Model): elif node.tag == 'img' and not node.get('src', 'data').startswith('data'): node.set('src', _process_link(node.get('src'))) - html = lxml.etree.tostring(root, pretty_print=False) + html = lxml.html.tostring(root, pretty_print=False, method='html') + # this is ugly, but lxml/etree tostring want to put everything in a 'div' that breaks the editor -> remove that + if html.startswith('
') and html.endswith('
'): + html = html[5:-6] return html def create(self, cr, uid, values, context=None):