save_values

This commit is contained in:
Emmanuel Garette 2019-12-03 08:47:12 +01:00
parent 03937baf51
commit bb1fdcbad0
2 changed files with 6 additions and 10 deletions

View File

@ -196,12 +196,17 @@ class Risotto(Controller):
session = self.get_session(session_id,
type)
id_ = session['id']
config_module = dispatcher.get_service('config')
if type == 'server':
storage = storage_server
config = config_module.server[id_]['server']
else:
storage = storage_servermodel
config = config_module.servermodel[id_]
if save:
storage.save_values(session_id)
modif_config = session['config']
config.value.importation(modif_config.value.exportation())
config.permissive.importation(modif_config.permissive.exportation())
storage.del_session(session_id)
return self.format_session(session_id, session)

View File

@ -85,15 +85,6 @@ class Storage(object):
raise Exception(f'the session {id} not exists')
return self.sessions[id]
def save_values(self, id_):
# FIXME
config = self.sessions[id_]['config']
server_id = self.sessions[id_]['id']
orig_config = self.sessions[id_]['orig_config']
values = config.value.exportation()
orig_config.value.importation(values)
orig_config.permissive.importation(config.permissive.exportation())
def get_username(self,
id: int):
return self.get_session(id)['username']