diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2011-02-15 23:15:26 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2011-02-15 23:25:50 +0100 |
commit | 2dd3007b8502a4fdb93228850d147b93cf8cb97d (patch) | |
tree | 5944d34a89c44ead4b1c95fcba5f54a2979ed52d | |
parent | 5bf74d3b3cd0cc59bf8debd047aebe74cf59a111 (diff) |
Do str.encode() when calling irc.msg().
-rwxr-xr-x | gitnoti.py | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -88,9 +88,9 @@ def repo_commit_msg(repo, branch, commits): reponame, ('/'+branch) if branch else '', commit.hexsha[:7], - commit.committer.name if commit.author.name.encode('utf8', 'replace') == commit.committer.name else '%s/%s' % (commit.committer.name, commit.author.name.encode('utf8', 'replace')), + commit.committer.name if commit.author.name == commit.committer.name else '%s/%s' % (commit.committer.name, commit.author.name), stat, - commit.summary.encode('utf8', 'replace') + commit.summary ) if options.url: @@ -106,7 +106,7 @@ def repo_commit_msg(repo, branch, commits): short_url = None if short_url: - url = short_url.encode('utf-8', 'replace') + url = short_url msg += url return msg @@ -326,7 +326,7 @@ class Bot(irc.IRCClient): return msg = repo_commit_msg(repo, branch, commits) - self.msg(target, msg) + self.msg(target, msg.encode('utf-8')) elif cmd == 'branches': if not len(messagelist) == 3: self.msg(target, 'Usage: %s branches REPO' % self.nickname) @@ -337,7 +337,8 @@ class Bot(irc.IRCClient): return reponame = os.path.splitext(os.path.basename(repo.working_dir))[0] - self.msg(target, '\002%s\002 has branches %s' % (reponame, ', '.join(sorted(['\002%s\002' % h.name for h in repo.heads])))) + msg = '\002%s\002 has branches %s' % (reponame, ', '.join(['\002%s\002' % h.name for h in repo.heads])) + self.msg(target, msg.encode('utf-8')) elif cmd == 'tags': if not len(messagelist) == 3: self.msg(target, 'Usage: %s tags REPO' % self.nickname) @@ -349,9 +350,10 @@ class Bot(irc.IRCClient): reponame = os.path.splitext(os.path.basename(repo.working_dir))[0] if not len(repo.tags): - self.msg(target, '\002%s\002 has no tags.' % reponame) + msg = '\002%s\002 has no tags.' % reponame else: - self.msg(target, '\002%s\002 has tags %s' % (reponame, ', '.join(sorted(['\002%s\002' % t.name for t in repo.tags])))) + msg = '\002%s\002 has tags %s' % (reponame, ', '.join(['\002%s\002' % t.name for t in repo.tags])) + self.msg(target, msg.encode('utf-8')) class BotFactory(protocol.ReconnectingClientFactory): protocol = Bot |