Merge pull request #793 from gpodder/remove-advertise
[mygpo.git] / mygpo / api / httpresponse.py
blob9e69ca845985cb27505c340283abc3467041b60f
1 import json
3 from django.http import HttpResponse
6 class JsonResponse(HttpResponse):
7 def __init__(self, object, jsonp_padding=None):
8 content = json.dumps(object, ensure_ascii=True)
10 if jsonp_padding:
11 content = "%(func)s(%(obj)s)" % {"func": jsonp_padding, "obj": content}
12 content_type = "application/json-p"
14 else:
15 content_type = "application/json"
17 super(JsonResponse, self).__init__(content, content_type=content_type)