[FIX] Moved definition of smtplib error logger in the right scope.
bzr revid: jth@openerp.com-20100923135820-t1uqp0k4iwfgxaw6
This commit is contained in:
parent
2bc3199535
commit
d90f632ad7
|
@ -419,6 +419,13 @@ def _email_send(smtp_from, smtp_to_list, message, openobject_id=None, ssl=False,
|
|||
:return: True if the mail was delivered successfully to the smtp,
|
||||
else False (+ exception logged)
|
||||
"""
|
||||
class WriteToLogger(object):
|
||||
def __init__(self):
|
||||
self.logger = netsvc.Logger()
|
||||
|
||||
def write(self, s):
|
||||
self.logger.notifyChannel('email_send', netsvc.LOG_DEBUG, s)
|
||||
|
||||
if openobject_id:
|
||||
message['Message-Id'] = generate_tracking_message_id(openobject_id)
|
||||
|
||||
|
@ -534,13 +541,6 @@ def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=Non
|
|||
part.add_header('Content-Disposition', 'attachment; filename="%s"' % (fname,))
|
||||
msg.attach(part)
|
||||
|
||||
class WriteToLogger(object):
|
||||
def __init__(self):
|
||||
self.logger = netsvc.Logger()
|
||||
|
||||
def write(self, s):
|
||||
self.logger.notifyChannel('email_send', netsvc.LOG_DEBUG, s)
|
||||
|
||||
return _email_send(email_from, flatten([email_to, email_cc, email_bcc]), msg, openobject_id=openobject_id, ssl=ssl, debug=debug)
|
||||
|
||||
#----------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue