def delete(self, method_name): rpc_file = RPCMethod(os.path.join(self.api_dir, RPCHandler.PATH), method_name) rpc_file.delete() self.api_data.delete_resource("RPC-%s" % method_name) self.set_flash_message("success", "RPC method has been successfully deleted.") self.redirect("/__manage")
def delete(self, method_name): rpc_file = RPCMethod( os.path.join(self.api_dir, RPCHandler.PATH), method_name) rpc_file.delete() self.api_data.delete_resource("RPC-%s" % method_name) self.set_flash_message( "success", "RPC method has been successfully deleted.") self.redirect("/__manage")
def post(self): # check xsrf cookie self.check_xsrf_cookie() # get data from request body data = tornado.escape.json_decode(self.request.body) if data["protocol"] == "rest": method, url_path = data["id"].split("-") method_file = ResourceMethod(self.api_dir, url_path, method) elif data["protocol"] == "rpc": method_file = RPCMethod( os.path.join(self.api_dir, RPCHandler.PATH), data["id"]) # load description method_file.load_description() # set todo value = " %s" % data["value"].strip() todo = "%s%s" % ("[x]" if data["checked"] else "[ ]", value) method_file.description = re.sub( r"\[( |x)\]%s" % re.escape(value), todo, method_file.description) # save description method_file.save_description() self.set_header("Content-Type", "application/json") self.write("OK")
def post(self): # check xsrf cookie self.check_xsrf_cookie() # get data from request method_name = self.get_argument("method_name") method_response = self.get_argument("method_response") category = self.get_argument("category", "") description = self.get_argument("description", "") # save method rpc_file = RPCMethod(os.path.join(self.api_dir, RPCHandler.PATH), method_name) rpc_file.description = description rpc_file.save(method_response) # add method to category self.api_data.save_category("RPC-%s" % method_name, category) self.set_flash_message( "success", "RPC method '%s' has been successfully created." % method_name) self.redirect("/__manage")
def post(self): # check xsrf cookie self.check_xsrf_cookie() # get data from request method_name = self.get_argument("method_name") method_response = self.get_argument("method_response") category = self.get_argument("category", "") description = self.get_argument("description", "") # save method rpc_file = RPCMethod( os.path.join(self.api_dir, RPCHandler.PATH), method_name) rpc_file.description = description rpc_file.save(method_response) # add method to category self.api_data.save_category( "RPC-%s" % method_name, category) self.set_flash_message( "success", "RPC method '%s' has been successfully created." % method_name) self.redirect("/__manage")
def get(self): method_name = self.get_argument("method_name", "") method_file = RPCMethod( os.path.join(self.api_dir, RPCHandler.PATH), method_name) method_file.load() method_file.load_description() category = self.api_data.get_rpc_category(method_name) self.render( "create_resource.html", protocol="rpc", category=category, method_file=method_file, SUPPORTED_FORMATS=SUPPORTED_FORMATS.keys(), jsonrpc=jsonrpc_available)