openlabs / poweremail

Email module for OpenERP
23 stars 20 forks source link

Error downloading Full Mail #15

Closed Naghual closed 12 years ago

Naghual commented 12 years ago

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_headertext(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_headertext(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_headertext(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_attvals, context)) 790 logger.notifyChannel(("Power Email"), netsvc.LOGINFO, ("Downloaded & saved %s attachments Account: %s.") % (len(att_ids), coreaccountid)) (Pdb)

prakharbansal commented 12 years ago

Hello Naghual,

We tried replicating the issue with several special characters including Russian characters. And we were not able to replicate the same. Can you please update your code to dev branch and try it again.

In case you face this issue again then please open a new ticket. Also paste the stacktrace and the subject of the mail that you are trying to download.