copy/deepcopy groupconfig

This commit is contained in:
Emmanuel Garette 2019-05-27 16:11:41 +02:00
parent 552cd3740d
commit 5498a12b2b
1 changed files with 24 additions and 4 deletions

View File

@ -1250,9 +1250,9 @@ class _TiramisuContextConfig(TiramisuContext, _TiramisuContextConfigReset):
return self._config_bag.context.impl_getname() return self._config_bag.context.impl_getname()
def copy(self, def copy(self,
session_id=None, session_id=None,
persistent=False, persistent=False,
storage=None): storage=None):
return Config(self._config_bag.context.duplicate(session_id, return Config(self._config_bag.context.duplicate(session_id,
persistent=persistent, persistent=persistent,
storage=storage)) storage=storage))
@ -1303,7 +1303,27 @@ class _TiramisuContextGroupConfig(TiramisuContext):
config = self._config_bag.context config = self._config_bag.context
for spath in spaths: for spath in spaths:
config = config.getconfig(spath) config = config.getconfig(spath)
return Config(config)
def copy(self,
session_id=None,
persistent=False,
storage=None):
return Config(self._config_bag.context.duplicate(session_id,
persistent=persistent,
storage=storage))
def deepcopy(self,
session_id=None,
persistent=False,
storage=None,
metaconfig_prefix=None):
return Config(self._config_bag.context.duplicate(session_id,
persistent=persistent,
storage=storage,
metaconfig_prefix=metaconfig_prefix,
deep=True))
return Config(config)
def path(self): def path(self):
return self._config_bag.context.cfgimpl_get_config_path() return self._config_bag.context.cfgimpl_get_config_path()