From 70c710cb82cf1b12ae8dcd0df3e7d510114f4c05 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 19 Dec 2012 15:07:48 +0100 Subject: [PATCH] [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 --- addons/mail/mail_message.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index d545f3782b4..14d3cce031a 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -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 = '

Encoding Error :
Unable to convert this message (id: %s).

' % 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,