'new' config allow storage

This commit is contained in:
Emmanuel Garette 2019-12-08 08:14:36 +01:00
parent 9cc4518087
commit d9c0b18404
2 changed files with 7 additions and 1 deletions

View File

@ -1451,10 +1451,12 @@ class _TiramisuContextMetaConfig(_TiramisuContextMixConfig):
def new(self,
session_id,
persistent=False,
storage=None,
type='config'):
"""Create and add a new config"""
new_config = self._config_bag.context.new_config(session_id=session_id,
persistent=persistent,
storage=storage,
type_=type)
return self._return_config(new_config)

View File

@ -1214,7 +1214,8 @@ class KernelMetaConfig(KernelMixConfig):
def new_config(self,
session_id,
type_='config',
persistent=False):
persistent=False,
storage=None):
if 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))
@ -1224,18 +1225,21 @@ class KernelMetaConfig(KernelMixConfig):
config = KernelConfig(self._impl_descr,
session_id=session_id,
persistent=persistent,
storage=storage,
display_name=self._display_name)
elif type_ == 'metaconfig':
config = KernelMetaConfig([],
optiondescription=self._impl_descr,
session_id=session_id,
persistent=persistent,
storage=storage,
display_name=self._display_name)
elif type_ == 'mixconfig':
config = KernelMixConfig(children=[],
optiondescription=self._impl_descr,
session_id=session_id,
persistent=persistent,
storage=storage,
display_name=self._display_name)
# Copy context properties/permissives
if new: