'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, def new(self,
session_id, session_id,
persistent=False, persistent=False,
storage=None,
type='config'): type='config'):
"""Create and add a new config""" """Create and add a new config"""
new_config = self._config_bag.context.new_config(session_id=session_id, new_config = self._config_bag.context.new_config(session_id=session_id,
persistent=persistent, persistent=persistent,
storage=storage,
type_=type) type_=type)
return self._return_config(new_config) return self._return_config(new_config)

View File

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