#NEWLINE# @ tornado . web . authenticated #NEWLINE# def post( self ) : #NEWLINE# #INDENT# self . check_xsrf_cookie ( ) #NEWLINE# data = tornado . escape . json_decode ( self . request . body ) #NEWLINE# if ( data [ 'protocol' ] == 'rest' ) : #NEWLINE# #INDENT# ( method , url_path ) = data [ 'id' ] . split ( '-' ) #NEWLINE# method_file = ResourceMethod ( self . api_dir , url_path , method ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( data [ 'protocol' ] == 'rpc' ) : #NEWLINE# #INDENT# method_file = RPCMethod ( os . path . join ( self . api_dir , RPCHandler . PATH ) , data [ 'id' ] ) #NEWLINE# #UNINDENT# #UNINDENT# method_file . load_description ( ) #NEWLINE# value = ( ' %s' % data [ 'value' ] . strip ( ) ) #NEWLINE# todo = ( '%s%s' % ( ( '[x]' if data [ 'checked' ] else '[ ]' ) , value ) ) #NEWLINE# method_file . description = re . sub ( ( '\\[( |x)\\]%s' % re . escape ( url_path ) ) , todo , method_file . description ) #NEWLINE# method_file . save_description ( ) #NEWLINE# self . set_header ( 'Content-Type' , 'application/json' ) #NEWLINE# self . write ( 'OK' )