#NEWLINE# def jsonify( data , status = 200 , headers = None ) : #NEWLINE# #INDENT# if ( headers is None ) : #NEWLINE# #INDENT# headers = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# jsonp = RequestParams . get ( 'jsonp' , False ) #NEWLINE# body = json . dumps ( data , cls = JSONEncoder ) #NEWLINE# if jsonp : #NEWLINE# #INDENT# headers [ 'Content-Type' ] = 'text/javascript' #NEWLINE# body = '{0}({1})' . format ( jsonp , body ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# headers [ 'Content-Type' ] = 'application/json' #NEWLINE# #UNINDENT# return ( body , status , headers )