Skip to content

Commit

Permalink
Merge pull request #36 from mattrobenolt/u8
Browse files Browse the repository at this point in the history
Switch from u8 to utf-8
  • Loading branch information
dcramer committed Sep 10, 2015
2 parents cb1dc1f + f2d1a5d commit d0ca57b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions sentry_hipchat/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,29 +91,27 @@ def notify_users(self, group, event, fail_silently=False):
link = group.get_absolute_url()
endpoint = self.get_option('endpoint', project) or DEFAULT_ENDPOINT


if token and room:
self.send_payload(
endpoint=endpoint,
token=token,
room=room,
message='[%(level)s]%(project_name)s %(message)s [<a href="%(link)s">view</a>]' % {
'level': escape(level),
'project_name': (' <strong>%s</strong>' % escape(project.name)) if include_project_name else '',
'project_name': (' <strong>%s</strong>' % escape(project.name)).encode('utf-8') if include_project_name else '',
'message': escape(event.error()),
'link': escape(link),
},
notify=notify,
color=COLORS.get(level, 'purple'),
)


def send_payload(self, endpoint, token, room, message, notify, color='red'):
values = {
'auth_token': token,
'room_id': room.encode('u8'),
'room_id': room.encode('utf-8'),
'from': 'Sentry',
'message': message.encode('u8'),
'message': message.encode('utf-8'),
'notify': int(notify),
'color': color,
}
Expand Down

0 comments on commit d0ca57b

Please sign in to comment.