# HG changeset patch # User Franz Glasner # Date 1692104951 -7200 # Node ID 6557cf9ecea5ae565f7cd40e68ededd6fdd6e3dc # Parent ff0de14493f11de80e5de71ef28a20da40ff9cef FIX: When using attribute access for configurations the values are interpolated since long ago: fix the docu and add a test for that behaviour diff -r ff0de14493f1 -r 6557cf9ecea5 configmix/config.py --- a/configmix/config.py Tue Aug 15 14:31:46 2023 +0200 +++ b/configmix/config.py Tue Aug 15 15:09:11 2023 +0200 @@ -474,8 +474,8 @@ """The configuration dictionary with attribute support or variable substitution. - .. note:: When retrieving by attribute names variables will *not* - substituted. + .. note:: When retrieving by attribute names variables will be + interpolated. """ @@ -1023,7 +1023,7 @@ "%r (cached)" % (s, )) else: return res - + if ((len_s >= 6) and (s[2] == _FILTER_SEPARATOR) and (start == 0)): diff -r ff0de14493f1 -r 6557cf9ecea5 tests/test.py --- a/tests/test.py Tue Aug 15 14:31:46 2023 +0200 +++ b/tests/test.py Tue Aug 15 15:09:11 2023 +0200 @@ -1869,6 +1869,12 @@ self.assertEqual(0x20, jcfg.key3) self.assertEqual(u"off", jcfg.tree2.key6) + def test_attribute_access_interpolates(self): + cfg = configmix.load(os.path.join(TESTDATADIR, "conf10.py")) + self.assertEqual( + [u"val1", u"val2", u"in the root namespace"], + cfg.tree1.tree2.key8) + def test_attribute_access_non_existing(self): cfg = configmix.load(os.path.join(TESTDATADIR, "conf10.py")) jcfg = cfg.jailed(rootpath=(u"tree1",))