This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def jsonp(f): | |
"""Wrap a json response in a callback, and set the mimetype (Content-Type) header accordingly | |
(will wrap in text/javascript if there is a callback). If the "callback" or "jsonp" paramters | |
are provided, will wrap the json output in callback({thejson}) | |
Usage: | |
@jsonp | |
def my_json_view(request): | |
d = { 'key': 'value' } |