From ccf3f0ae06d2a68feab5ca7e3939e9dac4b0063b Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 13 Sep 2018 06:50:26 +0200 Subject: [PATCH] when use config.new(), copy properties and permissives --- test/test_duplicate_config.py | 6 +++--- tiramisu/config.py | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/test/test_duplicate_config.py b/test/test_duplicate_config.py index f745fbc..2ed0805 100644 --- a/test/test_duplicate_config.py +++ b/test/test_duplicate_config.py @@ -77,9 +77,9 @@ def test_copy_force_store_value(): def test_copy_force_store_value_metaconfig(): descr = make_description() meta = MetaConfig([], optiondescription=descr) + meta.property.read_only() conf = meta.config.new(session_id='conf') + assert meta.property.get() == conf.property.get() + assert meta.permissive.get() == conf.permissive.get() assert to_tuple(conf.value.exportation()) == (('creole.general.wantref',), (None,), (False,), ('forced',)) assert to_tuple(meta.value.exportation()) == (('creole.general.wantref',), (None,), (False,), ('forced',)) - conf.option('creole.general.wantref').value.set(True) - assert to_tuple(conf.value.exportation()) == (('creole.general.wantref',), (None,), (True,), ('user',)) - assert to_tuple(meta.value.exportation()) == (('creole.general.wantref',), (None,), (False,), ('forced',)) diff --git a/tiramisu/config.py b/tiramisu/config.py index 4a27cb7..4803cde 100644 --- a/tiramisu/config.py +++ b/tiramisu/config.py @@ -1133,6 +1133,10 @@ class KernelMetaConfig(KernelGroupConfig): if config._impl_name 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)) + # 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()) + config._impl_meta = weakref.ref(self) self._impl_children.append(config) return config