[FIX] tools: mail: fixed last commit, now simply using replace

bzr revid: tde@openerp.com-20140123141435-jstfcaemjplbn7b1
This commit is contained in:
Thibault Delavallée 2014-01-23 15:14:35 +01:00
parent 5f1ec49ecd
commit 69af79ff3d
1 changed files with 4 additions and 2 deletions

View File

@ -29,7 +29,6 @@ import re
import socket
import threading
import time
import xml
from email.utils import getaddresses
import openerp
@ -97,7 +96,10 @@ def html_sanitize(src, silent=True, strict=False):
cleaner = clean.Cleaner(**kwargs)
cleaned = cleaner.clean_html(src)
# MAKO compatibility: $, { and } inside quotes are escaped, preventing correct mako execution
cleaned = xml.sax.saxutils.unescape(cleaned, {'%24': '$', '%7B': '{', '%7D': '}', '%20': ' '})
cleaned = cleaned.replace('%24', '$')
cleaned = cleaned.replace('%7B', '{')
cleaned = cleaned.replace('%7D', '}')
cleaned = cleaned.replace('%20', ' ')
except etree.ParserError, e:
if 'empty' in str(e):
return ""