Adding a check to see if the color is 'None' before lowercasing it for @matburt

This commit is contained in:
Romain Brucker 2017-09-28 11:15:14 -05:00
parent e67549e4a1
commit 1bb72cc680

View File

@ -26,10 +26,13 @@ class HipChatBackend(AWXBaseEmailBackend):
def __init__(self, token, color, api_url, notify, fail_silently=False, **kwargs):
super(HipChatBackend, self).__init__(fail_silently=fail_silently)
self.token = token
self.color = color
if color == 'None':
self.color = color
else:
self.color = color.lower()
self.api_url = api_url
self.notify = notify
def send_messages(self, messages):
sent_messages = 0
@ -38,7 +41,7 @@ class HipChatBackend(AWXBaseEmailBackend):
r = requests.post("{}/v2/room/{}/notification".format(self.api_url, rcp),
params={"auth_token": self.token},
verify=False,
json={"color": self.color.lower(),
json={"color": self.color,
"message": m.subject,
"notify": self.notify,
"from": m.from_email,