forked from Infra/risotto
save_values
This commit is contained in:
parent
03937baf51
commit
bb1fdcbad0
|
@ -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)
|
||||
|
||||
|
|
|
@ -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']
|
||||
|
|
Loading…
Reference in New Issue