diff --git a/tiramisu/api.py b/tiramisu/api.py index 77c127a..049b2ce 100644 --- a/tiramisu/api.py +++ b/tiramisu/api.py @@ -1001,8 +1001,11 @@ class TiramisuContextConfig(TiramisuContext): def _m_new(self, session_id, - persistent=False): - return Config(self.config_bag.context.new_config(session_id=session_id, persistent=persistent)) + persistent=False, + type='config'): + return Config(self.config_bag.context.new_config(session_id=session_id, + persistent=persistent, + type_=type)) def _m_pop(self, session_id): diff --git a/tiramisu/config.py b/tiramisu/config.py index aa04f50..1c945f1 100644 --- a/tiramisu/config.py +++ b/tiramisu/config.py @@ -1125,14 +1125,22 @@ class KernelMetaConfig(KernelGroupConfig): def new_config(self, session_id, + type_='config', persistent=False): - config = KernelConfig(self._impl_descr, - session_id=session_id, - persistent=persistent) - - if config._impl_name in [child._impl_name for child in self._impl_children]: # pragma: no cover + if session_id in [child._impl_name for child in self._impl_children]: # pragma: no cover raise ConflictError(_('config name must be uniq in ' - 'groupconfig for {0}').format(config._impl_name)) + 'groupconfig for {0}').format(session_id)) + if type_ == 'config': + config = KernelConfig(self._impl_descr, + session_id=session_id, + persistent=persistent) + elif type_ == 'metaconfig': + config = KernelMetaConfig([], + optiondescription=self._impl_descr, + session_id=session_id, + persistent=persistent) + else: + raise ConfigError(_('unknown type {}').format(type_)) # Copy context properties/permissives config.cfgimpl_get_settings().set_context_properties(self.cfgimpl_get_settings().get_context_properties(), config) config.cfgimpl_get_settings().set_context_permissives(self.cfgimpl_get_settings().get_context_permissives())