Colin Watson has proposed merging ~cjwatson/launchpad:py3-parseaddr-round-trip 
into launchpad:master.

Commit message:
Test parseaddr round-tripping in sending-mail.txt

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398700

On Python 3, `simple_sendmail_from_person` (via `email.utils.formataddr`) 
formats some names slightly differently.  For instance, 'Foo [Baz] " Bar' is 
encoded as "Foo [Baz] \" Bar" rather than "Foo \[Baz\] \" Bar".  What we really 
care about is that the result parses correctly, so test that rather than the 
exact details of the encoding.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:py3-parseaddr-round-trip into launchpad:master.
diff --git a/lib/lp/services/mail/doc/sending-mail.txt b/lib/lp/services/mail/doc/sending-mail.txt
index ecf5c50..ad7e235 100644
--- a/lib/lp/services/mail/doc/sending-mail.txt
+++ b/lib/lp/services/mail/doc/sending-mail.txt
@@ -184,8 +184,8 @@ surrounded by quotes and quoted if necessary:
 
     >>> from_addr, to_addr, raw_message = stub.test_emails.pop()
     >>> msg = message_from_bytes(raw_message)
-    >>> print(msg['From'])
-    "Foo \[Baz\] \" Bar" <[email protected]>
+    >>> parseaddr(msg['From'])
+    ('Foo [Baz] " Bar', '[email protected]')
 
 
 If we pass a unicode object to send_mail, it will try and covert it.  If a
_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : https://help.launchpad.net/ListHelp

Reply via email to