#NEWLINE# @ csrf_exempt #NEWLINE# def rest( request , * pargs ) : #NEWLINE# #INDENT# '\n    Calls python function corresponding with HTTP METHOD name. \n    Calls with incomplete arguments will return HTTP 400\n    ' #NEWLINE# if ( request . method == 'GET' ) : #NEWLINE# #INDENT# rest_function = get #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# rest_function = post #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( request . method == 'PUT' ) : #NEWLINE# #INDENT# rest_function = put #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( request . method == 'DELETE' ) : #NEWLINE# #INDENT# rest_function = delete #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return JsonResponse ( { #NEWLINE# #INDENT# 'error' : 'HTTP METHOD UNKNOWN' , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# try : #NEWLINE# #INDENT# return rest_function ( request , * request ) #NEWLINE# #UNINDENT# except TypeError : #NEWLINE# #INDENT# return HttpResponseBadRequest ( 'argument mismatch' )