def save_conf(request): params = request.params files = request.files if 'server_binary' in files: params['server'] = os.path.join(server_folder, files['server_binary'].filename) if os.path.exists(params['server']): os.remove(params['server']) files['server_binary'].save(server_folder) os.chmod(params['server'], 755) elif params.get('server', ''): # don't change the server pass else: params['server'] = "" name = params['sv_name'] conf = dict([x for x in params.items()]) data = conf_table.find_one({'name': name}) if data: # Config exists data['conf'] = conf else: # New config data = {'name': name, 'conf': conf} conf_table.save(data)
def get_config(name): return conf_table.find_one({'name': name})