diff options
Diffstat (limited to 'addons/fetchmail/fetchmail.py')
| -rw-r--r-- | addons/fetchmail/fetchmail.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/addons/fetchmail/fetchmail.py b/addons/fetchmail/fetchmail.py index 38e7a1b9e4b..9f57e0fe616 100644 --- a/addons/fetchmail/fetchmail.py +++ b/addons/fetchmail/fetchmail.py @@ -37,6 +37,7 @@ from openerp import addons from openerp.osv import fields, osv from openerp import tools, api from openerp.tools.translate import _ +from openerp.exceptions import UserError _logger = logging.getLogger(__name__) @@ -159,8 +160,8 @@ openerp_mailgate: "|/path/to/openerp-mailgate.py --host=localhost -u %(uid)d -p connection = server.connect() server.write({'state':'done'}) except Exception, e: - _logger.exception("Failed to connect to %s server %s.", server.type, server.name) - raise osv.except_osv(_("Connection test failed!"), _("Here is what we got instead:\n %s.") % tools.ustr(e)) + _logger.info("Failed to connect to %s server %s.", server.type, server.name, exc_info=True) + raise UserError(_("Connection test failed: %s") % tools.ustr(e)) finally: try: if connection: @@ -206,7 +207,7 @@ openerp_mailgate: "|/path/to/openerp-mailgate.py --host=localhost -u %(uid)d -p strip_attachments=(not server.attach), context=context) except Exception: - _logger.exception('Failed to process mail from %s server %s.', server.type, server.name) + _logger.info('Failed to process mail from %s server %s.', server.type, server.name, exc_info=True) failed += 1 if res_id and server.action_id: action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids': [res_id], 'active_model': context.get("thread_model", server.object_id.model)}) @@ -215,7 +216,7 @@ openerp_mailgate: "|/path/to/openerp-mailgate.py --host=localhost -u %(uid)d -p count += 1 _logger.info("Fetched %d email(s) on %s server %s; %d succeeded, %d failed.", count, server.type, server.name, (count - failed), failed) except Exception: - _logger.exception("General failure when trying to fetch mail from %s server %s.", server.type, server.name) + _logger.info("General failure when trying to fetch mail from %s server %s.", server.type, server.name, exc_info=True) finally: if imap_server: imap_server.close() @@ -237,14 +238,14 @@ openerp_mailgate: "|/path/to/openerp-mailgate.py --host=localhost -u %(uid)d -p context=context) pop_server.dele(num) except Exception: - _logger.exception('Failed to process mail from %s server %s.', server.type, server.name) + _logger.info('Failed to process mail from %s server %s.', server.type, server.name, exc_info=True) failed += 1 if res_id and server.action_id: action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids': [res_id], 'active_model': context.get("thread_model", server.object_id.model)}) cr.commit() _logger.info("Fetched %d email(s) on %s server %s; %d succeeded, %d failed.", numMsgs, server.type, server.name, (numMsgs - failed), failed) except Exception: - _logger.exception("General failure when trying to fetch mail from %s server %s.", server.type, server.name) + _logger.info("General failure when trying to fetch mail from %s server %s.", server.type, server.name, exc_info=True) finally: if pop_server: pop_server.quit() |
