Merge lp:~bjornt/publish-bot/non-ascii-message into lp:publish-bot

Proposed by Björn Tillenius
Status: Merged
Approved by: Christopher Armstrong
Approved revision: 16
Merged at revision: 16
Proposed branch: lp:~bjornt/publish-bot/non-ascii-message
Merge into: lp:publish-bot
Diff against target: 20 lines (+2/-2)
1 file modified
bzrcommitmessage.py (+2/-2)
To merge this branch: bzr merge lp:~bjornt/publish-bot/non-ascii-message
Reviewer Review Type Date Requested Status
Christopher Armstrong Approve
Review via email: mp+156852@code.launchpad.net

Description of the change

Encode the message right before sending it.

Most of the message parts are unicode string, so better encode the whole
message instead of the individual parts.

Before this change things broke when trying to send the message, if any
of its parts contained non-ascii characters.

To post a comment you must log in.
Revision history for this message
Christopher Armstrong (radix) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrcommitmessage.py'
2--- bzrcommitmessage.py 2007-03-20 23:39:57 +0000
3+++ bzrcommitmessage.py 2013-04-03 13:43:36 +0000
4@@ -8,7 +8,7 @@
5
6 nickname = branch.get_config().get_nickname()
7 if branch_prefix:
8- branch_prefix = branch_prefix.encode('utf-8')
9+ branch_prefix = branch_prefix
10 nickname = "%s/%s" % (branch_prefix, nickname)
11 revision = branch.repository.get_revision(rev_id)
12 message = ("%s r%d committed by %s\r\n%s"
13@@ -24,7 +24,7 @@
14
15 packit = ''
16 for line in message.splitlines():
17- packit += '%s:#%s:%s\r\n' % (password, channel, line)
18+ packit += '%s:#%s:%s\r\n' % (password, channel, line.encode('utf-8'))
19 s.sendall(packit)
20 s.close()
21

Subscribers

People subscribed via source and target branches

to all changes: