summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2014-01-15 16:16:44 +0100
committerThibault Delavallée <tde@openerp.com>2014-01-15 16:16:44 +0100
commit6072e586f4fabd6d2193d8de0fe7a3ca24465cae (patch)
treee9e82e6ce81c0fac070c4619b15304582857dd45
parent3487d36fc29718c95fa1b43d82eaa81b20dd8cf9 (diff)
[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
-rw-r--r--addons/website_mail/models/email_template.py5
1 files changed, 4 insertions, 1 deletions
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('<div>') and html.endswith('</div>'):
+ html = html[5:-6]
return html
def create(self, cr, uid, values, context=None):