[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
This commit is contained in:
Thibault Delavallée
2014-01-15 16:16:44 +01:00
parent 3487d36fc2
commit 6072e586f4
+4 -1
View File
@@ -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('<div>') and html.endswith('</div>'):
html = html[5:-6]
return html
def create(self, cr, uid, values, context=None):