#NEWLINE# def json_error_response( func ) : #NEWLINE# #INDENT# @ wraps ( func ) #NEWLINE# def do_json_error_response( self , request , * args , **kwargs ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# return func ( self , request , * args , ** kwargs ) #NEWLINE# #UNINDENT# except PermissionDenied : #NEWLINE# #INDENT# return json_response ( request , { #NEWLINE# #INDENT# 'status' : 'Permission denied' , #NEWLINE# 'message' : 'You do not have permission to access this resource.' , #NEWLINE# #UNINDENT# } , status = 403 ) #NEWLINE# #UNINDENT# except Http404 : #NEWLINE# #INDENT# return json_response ( request , { #NEWLINE# #INDENT# 'status' : 'Not found' , #NEWLINE# 'message' : 'The resource you attempted to access does not exist.' , #NEWLINE# #UNINDENT# } , status = 404 ) #NEWLINE# #UNINDENT# #UNINDENT# return func