Changeset - 9c408c0f1c9b
[Not reviewed]
default
0 2 0
Mads Kiilerich (mads) - 6 years ago 2020-08-18 21:36:26
mads@kiilerich.com
Grafted from: 36541d4daa16
rcmail: pass smtplib.SMTP.sendmail to_addrs as list

Passing it as a set worked ... but is apparently wrong. The documentation states
it has to be a "list of addresses".

Pytype warned:

File "kallithea/lib/rcmail/smtp_mailer.py", line 99, in send: Function SMTP.sendmail was called with the wrong arguments [wrong-arg-types]
Expected: (self, from_addr, to_addrs: Union[Sequence[str], str], ...)
Actually passed: (self, from_addr, to_addrs: set, ...)
2 files changed with 2 insertions and 3 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/rcmail/smtp_mailer.py
Show inline comments
 
@@ -96,7 +96,7 @@ class SmtpMailer(object):
 
        if self.user and self.passwd:
 
            smtp_serv.login(self.user, self.passwd)
 

	
 
        smtp_serv.sendmail(msg.sender, msg.send_to, raw_msg.as_string())
 
        smtp_serv.sendmail(msg.sender, list(msg.send_to), raw_msg.as_string())
 
        logging.info('MAIL SENT TO: %s' % recipients)
 

	
 
        try:
kallithea/tests/other/test_mail.py
Show inline comments
 
@@ -21,9 +21,8 @@ class smtplib_mock(object):
 

	
 
    def sendmail(self, sender, dest, msg):
 
        smtplib_mock.lastsender = sender
 
        smtplib_mock.lastdest = dest
 
        smtplib_mock.lastdest = set(dest)
 
        smtplib_mock.lastmsg = msg
 
        pass
 

	
 

	
 
@mock.patch('kallithea.lib.rcmail.smtp_mailer.smtplib', smtplib_mock)
0 comments (0 inline, 0 general)