Commit f60a5328 authored by Rémi Duraffort's avatar Rémi Duraffort Committed by Neil Williams

callback: fix crash in python3

"POST data should be bytes, an iterable of bytes, or a file object. It cannot
be of type str."

Change-Id: I020fec71769b6ff953428f75692a8681e09645a9
(cherry picked from commit 2862c0c7)
parent f1201ec8
......@@ -2659,10 +2659,10 @@ class Notification(models.Model):
if callback_data:
headers['Authorization'] = callback_data['token']
if self.callback_content_type == Notification.JSON:
callback_data = simplejson.dumps(callback_data)
callback_data = simplejson.dumps(callback_data).encode("utf-8")
headers['Content-Type'] = 'application/json'
else:
callback_data = urlencode(callback_data)
callback_data = urlencode(callback_data).encode("utf-8")
headers['Content-Type'] = 'application/x-www-form-urlencoded'
if self.callback_url:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment