[FIX] fetchmail: fix

bzr revid: hmo@tinyerp.com-20110303103740-rza71diijr9hlysf
This commit is contained in:
Harry (OpenERP) 2011-03-03 16:07:40 +05:30
parent a2875d6d0d
commit 4ff5f75912
1 changed files with 5 additions and 3 deletions

View File

@ -185,8 +185,9 @@ class email_server(osv.osv):
except Exception, e:
logger.notifyChannel(server.type, netsvc.LOG_WARNING, '%s' % (tools.ustr(e)))
finally:
imap_server.close()
imap_server.logout()
if imap_server:
imap_server.close()
imap_server.logout()
elif server.type == 'pop':
try:
pop_server = self.button_confirm_login(cr, uid, [server.id], context=context)
@ -204,7 +205,8 @@ class email_server(osv.osv):
except Exception, e:
logger.notifyChannel(server.type, netsvc.LOG_WARNING, '%s' % (tools.ustr(e)))
finally:
pop_server.quit()
if pop_server:
pop_server.quit()
return True
email_server()