def jsonpify(data):
 document = json.dumps(data)
 mimetype = JSONAPI_MIMETYPE
 callback = request.args.get('callback', False)
 if callback:
  document = '{0}({1})'.format(callback, document)
  mimetype = JAVASCRIPT_MIMETYPE
 response = current_app.response_class(document, mimetype=mimetype)
 return response

def jsonpify ( data ) : document = json . dumps ( data ) mimetype = JSONAPI_MIMETYPE callback = request . args . get ( 'callback' , False ) if callback : document = '{0}({1})' . format ( callback , document ) mimetype = JAVASCRIPT_MIMETYPE response = current_app . response_class ( document , mimetype = mimetype ) return response
creates a http response containing json or jsonp data .