Mercurial > kallithea
changeset 8629:9c408c0f1c9b
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, ...)
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Tue, 18 Aug 2020 21:36:26 +0200 |
parents | 2864cff1f12a |
children | 11ab74b7701b |
files | kallithea/lib/rcmail/smtp_mailer.py kallithea/tests/other/test_mail.py |
diffstat | 2 files changed, 2 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/rcmail/smtp_mailer.py Sun Aug 23 14:50:56 2020 +0200 +++ b/kallithea/lib/rcmail/smtp_mailer.py Tue Aug 18 21:36:26 2020 +0200 @@ -96,7 +96,7 @@ 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:
--- a/kallithea/tests/other/test_mail.py Sun Aug 23 14:50:56 2020 +0200 +++ b/kallithea/tests/other/test_mail.py Tue Aug 18 21:36:26 2020 +0200 @@ -21,9 +21,8 @@ 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)