From 41a15f72a02613fc823e32c36f48444d555f1bb6 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 29 Jun 2010 15:56:11 +0200 Subject: [PATCH] [FIX] mail_gateway: correct encoding issues and undeclared variable bzr revid: odo@openerp.com-20100629135611-42mennhtzy0j33z0 --- addons/mail_gateway/mail_gateway.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/mail_gateway/mail_gateway.py b/addons/mail_gateway/mail_gateway.py index 21159a308d2..cdd1c61ee67 100644 --- a/addons/mail_gateway/mail_gateway.py +++ b/addons/mail_gateway/mail_gateway.py @@ -270,6 +270,7 @@ class mailgate_tool(osv.osv_memory): res_id = False # Create New Record into particular model def create_record(msg): + att_ids = [] if hasattr(model_pool, 'message_new'): res_id = model_pool.message_new(cr, uid, msg, context) else: @@ -284,7 +285,6 @@ class mailgate_tool(osv.osv_memory): data.update(self.get_partner(cr, uid, msg.get('from'), context=context)) res_id = model_pool.create(cr, uid, data, context=context) - att_ids = [] if attach: for attachment in msg.get('attachments', []): data_attach = { @@ -369,9 +369,9 @@ class mailgate_tool(osv.osv_memory): if encoding: content = unicode(content, encoding) if part.get_content_subtype() == 'html': - body = tools.html2plaintext(content) + body = tools.ustr(tools.html2plaintext(content)) elif part.get_content_subtype() == 'plain': - body = content + body = tools.ustr(content) elif part.get_content_maintype() in ('application', 'image', 'text'): filename = part.get_filename(); if filename : @@ -379,7 +379,7 @@ class mailgate_tool(osv.osv_memory): else: res = part.get_payload(decode=True) if encoding: - res = tools.ustr(res) + res = tools.ustr(res, encoding) body += res msg['body'] = body