[MERGE] fix for mail: catch exeption if the message body is not converted by html_email_clean. return an error message for rendering and raise the exception

bzr revid: chm@openerp.com-20121221125847-rjxyey9veasgr23a
This commit is contained in:
Christophe Matthieu 2012-12-21 13:58:47 +01:00
commit 7602c4f6d7
1 changed files with 7 additions and 1 deletions

View File

@ -350,9 +350,15 @@ class mail_message(osv.Model):
vote_nb = len(message.vote_user_ids)
has_voted = uid in [user.id for user in message.vote_user_ids]
try:
body_html = html_email_clean(message.body)
except Exception:
body_html = '<p><b>Encoding Error : </b><br/>Unable to convert this message (id: %s).</p>' % message.id
_logger.exception(Exception)
return {'id': message.id,
'type': message.type,
'body': html_email_clean(message.body or ''),
'body': body_html,
'model': message.model,
'res_id': message.res_id,
'record_name': message.record_name,