Merge lp:~julian-edwards/launchpad/utf-codes-in-emails-bug-817106 into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Julian Edwards |
Approved revision: | no longer in the source branch. |
Merged at revision: | 13558 |
Proposed branch: | lp:~julian-edwards/launchpad/utf-codes-in-emails-bug-817106 |
Merge into: | lp:launchpad |
Diff against target: |
286 lines (+110/-37) 2 files modified
lib/lp/soyuz/adapters/notification.py (+42/-17) lib/lp/soyuz/adapters/tests/test_notification.py (+68/-20) |
To merge this branch: | bzr merge lp:~julian-edwards/launchpad/utf-codes-in-emails-bug-817106 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Abel Deuring (community) | code | Approve | |
Review via email: mp+69758@code.launchpad.net |
Commit message
[r=adeuring][bug=817106] Make notification emails cope with UTF8 in the message.
Description of the change
= Summary =
Make notification emails cope with UTF8.
== Proposed fix ==
Look at https:/
which was the first ever sync done in production - the notification email
has mangled the Changed-By: in the body of the email. We need to fix that!
== Implementation details ==
Apart from Python being an utter PITA when dealing with unicode, the fix was
mostly straightforward apart from changing the fetch_information() function
to return a dictionary instead of that crazy tuple.
Using a dict makes it easier to add more returned data without affecting all
the callsites that don't care about that extra data.
The basic problem was that fetch_information() was assuming that the email
addresses it was returning would only ever be used in the email headers and
encoding them accordingly. I've added extra keys in the dict that contain
the email addresses in unicode strings instead of escaped ascii for headers,
then the whole email body is converted to utf8 before sending.
== Tests ==
bin/test -cvv test_notification
== Demo and Q/A ==
I'll be doing some syncs on staging/dogfood and examining the emails in
the staging inbox.
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/
nice branch!
Just a remark:
> +# -*- coding: utf-8 -*- www.python. org/dev/ peps/pep- 0263/.
> +# NOTE: The first line above must stay first; do not move the copyright
> +# notice to the top. See http://
[...]
> + RANDOM_UNICODE = u"Loïc"
I think we avoided to add the "coding: utf-8" line up to now and used string constants like u'Lo\u1234c' instead. But I think it is safe to assume that all editors we use work properly with utf-8 encoded files.