Merge lp:~mars/launchpad/fix-ec2-email-encoding into lp:launchpad

Proposed by Māris Fogels on 2010-04-16
Status: Merged
Approved by: Gary Poster on 2010-04-16
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~mars/launchpad/fix-ec2-email-encoding
Merge into: lp:launchpad
Diff against target: 12 lines (+1/-1)
1 file modified
lib/devscripts/ec2test/testrunner.py (+1/-1)
To merge this branch: bzr merge lp:~mars/launchpad/fix-ec2-email-encoding
Reviewer Review Type Date Requested Status
Gary Poster (community) 2010-04-16 Approve on 2010-04-16
Review via email: mp+23557@code.launchpad.net

Commit Message

This branch fixes a UnicodeEncodeError raised by ec2test when using an email address that contains unicode characters.

Description of the Change

This branch fixes a UnicodeEncodeError raised by ec2test when using an email address that contains unicode characters.

The fix encodes the unicode email address object to a UTF-8 binary string, which SFTP then handles correctly.

To post a comment you must log in.
Gary Poster (gary) wrote :

[11:29am] gary_poster: mars, I'm guessing you have empirical proof it works?
[11:29am] mars: gary_poster, just a traceback from danilos sent to lp-dev. This same fix is present throughout the ec2test.py file.
[11:31am] mars: gary_poster, I have have danilos try it out before submitting to PQM
[11:32am] gary_poster: mars, alright. I have vague memories of pain with UTF in email headers and the stdlib email packages, but even if things don't get better, this shouldn't make anything worse (and hopefully it is a fix, of course!). Yes, would be happy if someone gave it a try before merging. Will approve with that condition, since you already have it planned.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/devscripts/ec2test/testrunner.py'
2--- lib/devscripts/ec2test/testrunner.py 2010-04-10 14:40:32 +0000
3+++ lib/devscripts/ec2test/testrunner.py 2010-04-16 15:26:27 +0000
4@@ -325,7 +325,7 @@
5 bazaar_conf_file = user_connection.sftp.open(
6 ".bazaar/bazaar.conf", 'w')
7 bazaar_conf_file.write(
8- 'email = %s\n' % (self._from_email,))
9+ 'email = %s\n' % (self._from_email.encode('utf-8'),))
10 bazaar_conf_file.write(
11 'smtp_server = %s\n' % (self._smtp_server,))
12 if self._smtp_username: