new can create a metaconfig too
This commit is contained in:
parent
e6cbcde927
commit
77a77dd01c
2 changed files with 19 additions and 8 deletions
|
@ -1001,8 +1001,11 @@ class TiramisuContextConfig(TiramisuContext):
|
||||||
|
|
||||||
def _m_new(self,
|
def _m_new(self,
|
||||||
session_id,
|
session_id,
|
||||||
persistent=False):
|
persistent=False,
|
||||||
return Config(self.config_bag.context.new_config(session_id=session_id, persistent=persistent))
|
type='config'):
|
||||||
|
return Config(self.config_bag.context.new_config(session_id=session_id,
|
||||||
|
persistent=persistent,
|
||||||
|
type_=type))
|
||||||
|
|
||||||
def _m_pop(self,
|
def _m_pop(self,
|
||||||
session_id):
|
session_id):
|
||||||
|
|
|
@ -1125,14 +1125,22 @@ class KernelMetaConfig(KernelGroupConfig):
|
||||||
|
|
||||||
def new_config(self,
|
def new_config(self,
|
||||||
session_id,
|
session_id,
|
||||||
|
type_='config',
|
||||||
persistent=False):
|
persistent=False):
|
||||||
|
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(session_id))
|
||||||
|
if type_ == 'config':
|
||||||
config = KernelConfig(self._impl_descr,
|
config = KernelConfig(self._impl_descr,
|
||||||
session_id=session_id,
|
session_id=session_id,
|
||||||
persistent=persistent)
|
persistent=persistent)
|
||||||
|
elif type_ == 'metaconfig':
|
||||||
if config._impl_name in [child._impl_name for child in self._impl_children]: # pragma: no cover
|
config = KernelMetaConfig([],
|
||||||
raise ConflictError(_('config name must be uniq in '
|
optiondescription=self._impl_descr,
|
||||||
'groupconfig for {0}').format(config._impl_name))
|
session_id=session_id,
|
||||||
|
persistent=persistent)
|
||||||
|
else:
|
||||||
|
raise ConfigError(_('unknown type {}').format(type_))
|
||||||
# Copy context properties/permissives
|
# 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_properties(self.cfgimpl_get_settings().get_context_properties(), config)
|
||||||
config.cfgimpl_get_settings().set_context_permissives(self.cfgimpl_get_settings().get_context_permissives())
|
config.cfgimpl_get_settings().set_context_permissives(self.cfgimpl_get_settings().get_context_permissives())
|
||||||
|
|
Loading…
Reference in a new issue