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

bzr revid: chm@openerp.com-20121219140748-ur02plu65i6ab9rw
This commit is contained in:
Christophe Matthieu
2012-12-19 15:07:48 +01:00
parent 5822bfa5ba
commit 70c710cb82
+7 -1
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,