From ae3af64c0966f95ef087d0be1741e5d9bb1de32b Mon Sep 17 00:00:00 2001 From: toyama0919 Date: Wed, 3 Aug 2016 09:56:54 +0900 Subject: [PATCH 1/2] Fix: Alert: when hipchat Alert.name is multibyte character, occur error. --- redash/destinations/hipchat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redash/destinations/hipchat.py b/redash/destinations/hipchat.py index b23189c7b..ff4a5ec23 100644 --- a/redash/destinations/hipchat.py +++ b/redash/destinations/hipchat.py @@ -42,7 +42,7 @@ class HipChat(BaseDestination): query_url=query_url) data = { - 'message': message, + 'message': message.encode('utf-8', 'ignore'), 'color': colors.get(new_state, 'green') } headers = {'Content-Type': 'application/json'} From 88d61e8faa611c4f5ea1831dd4986684a8379daa Mon Sep 17 00:00:00 2001 From: toyama0919 Date: Fri, 5 Aug 2016 10:50:18 +0900 Subject: [PATCH 2/2] apply reviews arikfr. string to unicode. --- redash/destinations/hipchat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/redash/destinations/hipchat.py b/redash/destinations/hipchat.py index ff4a5ec23..fee41830e 100644 --- a/redash/destinations/hipchat.py +++ b/redash/destinations/hipchat.py @@ -36,13 +36,13 @@ class HipChat(BaseDestination): alert_url = '{host}/alerts/{alert_id}'.format(host=host, alert_id=alert.id); query_url = '{host}/queries/{query_id}'.format(host=host, query_id=query.id); - message = '{alert_name} changed state to {new_state} (based on this query).'.format( + message = u'{alert_name} changed state to {new_state} (based on this query).'.format( alert_name=alert.name, new_state=new_state.upper(), alert_url=alert_url, query_url=query_url) data = { - 'message': message.encode('utf-8', 'ignore'), + 'message': message, 'color': colors.get(new_state, 'green') } headers = {'Content-Type': 'application/json'}