diff --git a/openerp/tools/mail.py b/openerp/tools/mail.py index 2cbb094bf8e..0ae4b373fee 100644 --- a/openerp/tools/mail.py +++ b/openerp/tools/mail.py @@ -19,11 +19,11 @@ # ############################################################################## -from lxml.etree import tostring, Element -try: - from lxml.html.soupparser import fromstring as parser_fromstring -except ImportError: - from lxml.html import fromstring as parser_fromstring +from lxml import etree +# try: +# from lxml.html.soupparser import fromstring as parser_fromstring +# except ImportError: +# from lxml.html import fromstring as parser_fromstring import logging import lxml.html import openerp.pooler as pooler @@ -122,15 +122,16 @@ def html_email_clean(html): br_tags = re.compile(r'([<]\s*br\s*\/?[>])') idx = 0 for item in re.finditer(br_tags, html): - modified_html += html[idx:item.start()] + '\n' + modified_html += html[idx:item.start()] + '__BR_TAG__' idx = item.end() modified_html += html[idx:] + html = modified_html # 2. form a tree, handle (currently ?) pure-text by enclosing them in a pre - root = parser_fromstring(modified_html) + root = lxml.html.fromstring(html) if not len(root) and root.text is None and root.tail is None: - modified_html = '