[MERGE] [IMP] mail sanitizer: do not remove comments in html body when cleaning ...
authorMartin Trigaux <mat@openerp.com>
Wed, 23 Apr 2014 13:19:19 +0000 (15:19 +0200)
committerMartin Trigaux <mat@openerp.com>
Wed, 23 Apr 2014 13:19:19 +0000 (15:19 +0200)
bzr revid: mat@openerp.com-20140423131919-q3vbw12tokglwdsq

1  2 
openerp/tools/mail.py

@@@ -339,6 -341,9 +341,10 @@@ def html_email_clean(html, remove=False
      overlength_section_count = 0
      cur_char_nbr = 0
      for node in root.iter():
+         # comments do not need processing
++        # note: bug in node.get(value, default) for HtmlComments, default never returned
+         if node.tag == etree.Comment:
+             continue
          # do not take into account multiple spaces that are displayed as max 1 space in html
          node_text = ' '.join((node.text and node.text.strip(' \t\r\n') or '').split())