Download full email more than once raise error

Bug #493627 reported by Sylvain Calador on 2009-12-07
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Power Email
New
Undecided
Unassigned

Bug Description

Download full email more than once raise error.

When trying to download full email more than once (on the same email),
I get the following backtrace:

Environment Information :
System : Linux-2.6.31-15-generic-i686-with-Ubuntu-9.10-karmic
OS Name : posix
Distributor ID: Ubuntu
Description: Ubuntu 9.10
Release: 9.10
Codename: karmic
Operating System Release : 2.6.31-15-generic
Operating System Version : #50-Ubuntu SMP Tue Nov 10 14:54:29 UTC 2009
Operating System Architecture : 32bit
Operating System Locale : fr_FR.UTF8
Python Version : 2.6.4
OpenERP-Client Version : 5.0.7
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
  File "/home/logicalsoft/openerp/server/bin/netsvc.py", line 244, in dispatch
    result = LocalService(service_name)(method, *params)
  File "/home/logicalsoft/openerp/server/bin/netsvc.py", line 73, in __call__
    return getattr(self, method)(*params)
  File "/home/logicalsoft/openerp/server/bin/service/web_services.py", line 579, in execute
    res = service.execute(db, uid, object, method, *args)
  File "/home/logicalsoft/openerp/server/bin/osv/osv.py", line 61, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/logicalsoft/openerp/server/bin/osv/osv.py", line 120, in execute
    res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/logicalsoft/openerp/server/bin/osv/osv.py", line 112, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/logicalsoft/openerp/server/bin/addons/poweremail/poweremail_mailbox.py", line 119, in complete_mail
    self.pool.get('poweremail.core_accounts').get_fullmail(cr,uid,id,ctx)
  File "/home/logicalsoft/openerp/server/bin/addons/poweremail/poweremail_core.py", line 585, in get_fullmail
    id = self.pool.get('poweremail.mailbox').read(cr, uid, mailid, ['pem_account_id'])['pem_account_id'][0]
TypeError: 'bool' object is unsubscriptable

Because in get_fullmail() the "for" loop use a variable id that is already defined
with the correct "pem_account_id".
585 id = self.pool.get('poweremail.mailbox').read(cr, uid, mailid, ['pem_account_id'])['pem_account_id'][0]
...
616 for id in range(0,len(msg)/2):
617 mails = msg[id*2]
618 flags = msg[(id*2)+1]
619 if type(mails) == type(('tuple', 'type')):
620 if '\Seen' in flags:
621 ctx['state'] = 'read'
622 mail = email.message_from_string(mails[1])
623 self.complete_mail(cr, uid, mail, id, server_ref, mailid,ctx)

Same thing in get_mails():

487 for id in ids:
...
531 for i in range(rec.last_mail_id + 1, int(msg_count[0]) + 1):
532 typ, msg = serv.fetch(str(i), '(FLAGS RFC822)')
533 for id in range(0,len(msg)/2):
534 mails = msg[id*2]
535 flags = msg[(id*2)+1]
536 if type(mails) == type(('tuple', 'type')):
537 if '\Seen' in flags:
538 ctx['state'] = 'read'
539 mail = email.message_from_string(mails[1])
540 if self.save_fullmail(cr, uid, mail, id, mails[0].split()[0],ctx):#If saved succedfully then increment last mai
541 self.write(cr, uid, id, {'last_mail_id':mails[0].split()[0]})

I have proposed a merge which fix those issues.

Best Regards,

Sylvain

Related branches

Revision history for this message
bousselmi (as-bousselmi) wrote :

I have I have problems with download full email mentioned in the ticket "92449

Revision history for this message
Sharoon Thomas http://openlabs.co.in (sharoonthomas) wrote :

I have merged the contribution by sylvain and this bug should be solved now

Cheers!

Sharoon

Revision history for this message
Gerhard du Toit (gdutoit) wrote :

Looks like it stil is a problem when there's n attachment
Get the message "File name mus be unique"

Revision history for this message
Sharoon Thomas http://openlabs.co.in (sharoonthomas) wrote :

Looks like you have the document module installed

Revision history for this message
Gerhard du Toit (gdutoit) wrote :

Yip, document management installed . . . but then a more meaningful message would be helpful.

Revision history for this message
Sylvain Calador (sylvain-calador) wrote :

Thanks for the merge Sharoon!

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers