Skip to content

Instantly share code, notes, and snippets.

@dickbrouwer
Created August 15, 2010 22:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dickbrouwer/526019 to your computer and use it in GitHub Desktop.
Save dickbrouwer/526019 to your computer and use it in GitHub Desktop.
class JsonpResponse(HttpResponse):
def __init__(self, data, callback):
json_encoder = LazyEncoder(ensure_ascii=False)
json = json_encoder.encode(data)
jsonp = "%s(%s)" % (callback, json)
HttpResponse.__init__(
self, jsonp,
mimetype='application/json'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment