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