openlabs/poweremail — Issue #15: Error downloading Full Mail
Author: Naghual
Created: 2012-02-07 13:13:17+00:00
State: open

Here is a tracelog:

[2012-02-07 15:09:37,894][openerp] INFO:Power Email:Starting Full mail reception for mail: 12.
[2012-02-07 15:09:37,902][openerp] INFO:Power Email:POP3 Server Connected & logged in successfully Account: 12.
[2012-02-07 15:09:37,905][openerp] INFO:Power Email:POP3 Statistics: 126 mails of 121716472 size for Account: 12:
[2012-02-07 15:09:37,919][openerp] INFO:Power Email:Mail 16 Saved successfully as ID: True for Account: 12.
[2012-02-07 15:09:37,920][openerp] ERROR:web-services:Uncaught exception
Traceback (most recent call last):
File "/opt/openerp/lib/python2.7/site-packages/openerp-server/osv/osv.py", line 122, in wrapper
return f(self, dbname, *args, **kwargs)
File "/opt/openerp/lib/python2.7/site-packages/openerp-server/osv/osv.py", line 176, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/opt/openerp/lib/python2.7/site-packages/openerp-server/osv/osv.py", line 167, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/opt/openerp/lib/python2.7/site-packages/openerp-server/addons/openlabs-poweremail-8edb1dc.zip/openlabs-poweremail-8edb1dc/mailbox.py", line 156, in complete_mail
self.pool.get('poweremail.core_accounts').get_fullmail(cr, uid, id, context)
File "/opt/openerp/lib/python2.7/site-packages/openerp-server/addons/openlabs-poweremail-8edb1dc.zip/openlabs-poweremail-8edb1dc/core.py", line 1043, in get_fullmail
server_ref, mailid, context)
File "/opt/openerp/lib/python2.7/site-packages/openerp-server/addons/openlabs-poweremail-8edb1dc.zip/openlabs-poweremail-8edb1dc/core.py", line 770, in complete_mail
self.save_attachments(cr, uid, mail, mailboxref, parsed_mail, coreaccountid, context)
File "/opt/openerp/lib/python2.7/site-packages/openerp-server/addons/openlabs-poweremail-8edb1dc.zip/openlabs-poweremail-8edb1dc/core.py", line 785, in save_attachments
'description':(self.decode_header_text(mail['subject']) or _('No Subject')) + " [Type:" + (each[0] or 'Unknown') + ", Filename:" + (each[1] or 'No Name') + "]",
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 5: ordinal not in range(128)
> /opt/openerp/lib/python2.7/site-packages/openerp-server/addons/openlabs-poweremail-8edb1dc.zip/openlabs-poweremail-8edb1dc/core.py(785)save_attachments()
-> 'description':(self.decode_header_text(mail['subject']) or _('No Subject')) + " [Type:" + (each[0] or 'Unknown') + ", Filename:" + (each[1] or 'No Name') + "]",

And the code piece:

(Pdb) l
780	for each in parsed_mail['attachments']:#Get each attachment
781	new_att_vals = {
782	'name':self.decode_header_text(mail['subject']) + '(' + each[0] + ')',
783	'datas':base64.b64encode(each[2] or ''),
784	'datas_fname':each[1],
785 ->	'description':(self.decode_header_text(mail['subject']) or _('No Subject')) + " [Type:" + (each[0] or 'Unknown') + ", Filename:" + (each[1] or 'No Name') + "]",
786	'res_model':'poweremail.mailbox',
787	'res_id':id
788	}
789	att_ids.append(att_obj.create(cr, uid, new_att_vals, context))
790	logger.notifyChannel(_("Power Email"), netsvc.LOG_INFO, _("Downloaded & saved %s attachments Account: %s.") % (len(att_ids), coreaccountid))
(Pdb)