launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26313
[Merge] ~cjwatson/launchpad:py3-MailController-to-addrs-bytes into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-MailController-to-addrs-bytes into launchpad:master.
Commit message:
Accept bytes to_addrs in MailController
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398033
lib/lp/services/mail/doc/sending-mail.txt attempts to pass to_addrs as bytes and assumes that MailController.__init__ will turn it into a list of bytes objects.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-MailController-to-addrs-bytes into launchpad:master.
diff --git a/lib/lp/services/mail/sendmail.py b/lib/lp/services/mail/sendmail.py
index 300d698..72ca82d 100644
--- a/lib/lp/services/mail/sendmail.py
+++ b/lib/lp/services/mail/sendmail.py
@@ -207,7 +207,7 @@ class MailController(object):
def __init__(self, from_addr, to_addrs, subject, body, headers=None,
envelope_to=None, bulk=True):
self.from_addr = from_addr
- if zisinstance(to_addrs, six.string_types):
+ if zisinstance(to_addrs, (bytes, six.text_type)):
to_addrs = [to_addrs]
self.to_addrs = to_addrs
self.envelope_to = envelope_to