add new argument in config.new()
This commit is contained in:
parent
6929d2740d
commit
2d2e8a63fb
2 changed files with 11 additions and 6 deletions
|
@ -1533,7 +1533,8 @@ class _TiramisuContextMixConfig(_TiramisuContextGroupConfig, _TiramisuContextCon
|
|||
async def new(self,
|
||||
session_id,
|
||||
storage=None,
|
||||
type='config'):
|
||||
type='config',
|
||||
new=None):
|
||||
"""Create and add a new config"""
|
||||
config = self._config_bag.context
|
||||
if storage is None:
|
||||
|
@ -1543,9 +1544,10 @@ class _TiramisuContextMixConfig(_TiramisuContextGroupConfig, _TiramisuContextCon
|
|||
new_config = await config.new_config(connection,
|
||||
session_id=session_id,
|
||||
storage=storage,
|
||||
type_=type)
|
||||
type_=type,
|
||||
new=new)
|
||||
return await self._return_config(new_config,
|
||||
new_config._storage)
|
||||
storage)
|
||||
|
||||
async def pop(self,
|
||||
session_id=None,
|
||||
|
|
|
@ -1175,12 +1175,15 @@ class KernelMixConfig(KernelGroupConfig):
|
|||
connection,
|
||||
session_id,
|
||||
type_='config',
|
||||
storage=None):
|
||||
if session_id in [child.impl_getname() for child in self._impl_children]:
|
||||
storage=None,
|
||||
new=None,
|
||||
):
|
||||
if new is None:
|
||||
new = session_id not in await list_sessions()
|
||||
if new and session_id in [child.impl_getname() for child in self._impl_children]:
|
||||
raise ConflictError(_('config name must be uniq in '
|
||||
'groupconfig for {0}').format(session_id))
|
||||
assert type_ in ('config', 'metaconfig', 'mixconfig'), _('unknown type {}').format(type_)
|
||||
new = session_id not in await list_sessions()
|
||||
if type_ == 'config':
|
||||
config = await KernelConfig(self._impl_descr,
|
||||
session_id=session_id,
|
||||
|
|
Loading…
Reference in a new issue