zerver/views/webhooks/bitbucket.py: Fix string literals.

Convert some strings literals to unicode.
This commit is contained in:
Eklavya Sharma 2016-06-26 13:49:12 +05:30 committed by Tim Abbott
parent 9b6205d0ed
commit 36c2214d94
1 changed files with 4 additions and 4 deletions

View File

@ -19,8 +19,8 @@ def api_bitbucket_webhook(request, user_profile, payload=REQ(validator=check_dic
stream=REQ(default='commits')): stream=REQ(default='commits')):
# type: (HttpRequest, UserProfile, Dict[str, Any], str) -> HttpResponse # type: (HttpRequest, UserProfile, Dict[str, Any], str) -> HttpResponse
repository = payload['repository'] repository = payload['repository']
commits = [{'id': commit['raw_node'], 'message': commit['message'], commits = [{u'id': commit['raw_node'], u'message': commit['message'],
'url': '%s%scommits/%s' % (payload['canon_url'], u'url': u'%s%scommits/%s' % (payload['canon_url'],
repository['absolute_url'], repository['absolute_url'],
commit['raw_node'])} commit['raw_node'])}
for commit in payload['commits']] for commit in payload['commits']]
@ -29,13 +29,13 @@ def api_bitbucket_webhook(request, user_profile, payload=REQ(validator=check_dic
if len(commits) == 0: if len(commits) == 0:
# Bitbucket doesn't give us enough information to really give # Bitbucket doesn't give us enough information to really give
# a useful message :/ # a useful message :/
content = ("%s [force pushed](%s)" content = (u"%s [force pushed](%s)"
% (payload['user'], % (payload['user'],
payload['canon_url'] + repository['absolute_url'])) payload['canon_url'] + repository['absolute_url']))
else: else:
branch = payload['commits'][-1]['branch'] branch = payload['commits'][-1]['branch']
content = build_commit_list_content(commits, branch, None, payload['user']) content = build_commit_list_content(commits, branch, None, payload['user'])
subject += '/%s' % (branch,) subject += u'/%s' % (branch,)
check_send_message(user_profile, get_client("ZulipBitBucketWebhook"), "stream", check_send_message(user_profile, get_client("ZulipBitBucketWebhook"), "stream",
[stream], subject, content) [stream], subject, content)