def save_parameter(cls, data): id = data.get_request_parameter("id") delete = data.get_request_parameter("delete", default=None) if delete is None: parameter = KMParameter.get(id) parameter.set_data(data) parameter.save() else: KMParameter.delete_by_id(id)
def admin_parameter(self): """ Find all the parameters. :return: parameters. """ self.result['menu_list'] = get_menu_list() self.result['parameters'] = KMParameter.all()
def search_parameter(self): """ Find all the parameters. :return: parameters. """ result = KMParameter.all() return create_result_4_array(result)
def search_parameter(self): """ Find all the parameters. :return: parameters. """ result = KMParameter.all() return create_result_4_array(result)
def engine_save_parameter(): """ Save the parameter. will save the json string in the following formats. Format: 'keyName':{"hoge":"fuga"} """ try: session = db_manager.get_session() for save_params in request.forms: json_data = json.loads(save_params.decode('utf-8')) for key in json_data: if json_data[key] == "": delete_parameter(key, session) # delete else: parameter = KMParameter() parameter.key = key parameter.json = json_data[key] update_parameter(parameter, session) finally: session.commit()
def save_parameter(self): """ Save the parameter. will save the json string in the following formats. Format: 'keyName':{"hoge":"fuga"} """ for save_params in self.data.get_request().forms: json_data = json.loads(save_params.decode(SETTINGS.CHARACTER_SET)) for key in json_data: if json_data[key] == "": KMParameter.delete_by_id(key) else: parameters = KMParameter.find(key=key) if not parameters: parameter = KMParameter() else: parameter = parameter[0] parameter.key = key parameter.json = json_data[key] parameter.save()
def save_parameter(self): """ Save the parameter. will save the json string in the following formats. Format: 'keyName':{"hoge":"fuga"} """ for save_params in self.data.get_request().forms: json_data = json.loads(save_params.decode(SETTINGS.CHARACTER_SET)) for key in json_data: if json_data[key] == "": KMParameter.delete_by_id(key) else: parameters = KMParameter.find(key=key) if not parameters: parameter = KMParameter() else: parameter = parameter[0] parameter.key = key parameter.json = json_data[key] parameter.save()
def admin_parameter_save(self): KMParameterAdmin.save_parameter(self.data) self.result['menu_list'] = get_menu_list() self.result['parameters'] = KMParameter.all()
def admin_parameter_edit(self): id = self.data.get_request_parameter("km_parameter_edit_id") self.result['menu_list'] = get_menu_list() self.result['parameter'] = KMParameter.get(id)