From d5b83c123c76e084b3688e8d7c0203bae77e89d7 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 20 Feb 2014 14:27:29 +0100 Subject: [PATCH] tiramisu/setting.py : properties store in cache was a reference to a list modified in validation, should copy properties in cache --- test/test_option_setting.py | 11 +++++++++++ tiramisu/setting.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/test/test_option_setting.py b/test/test_option_setting.py index ed5f7d7..94755e8 100644 --- a/test/test_option_setting.py +++ b/test/test_option_setting.py @@ -367,3 +367,14 @@ def test_reset_multiple(): setting[option].append('test') setting.reset(all_properties=True) setting.reset(all_properties=True) + + +def test_properties_cached(): + b1 = BoolOption("b1", "", properties=('test',)) + descr = OptionDescription("opt", "", [OptionDescription("sub", "", [b1])]) + c = Config(descr) + c.read_write() + setting = c.cfgimpl_get_settings() + option = c.cfgimpl_get_description().sub.b1 + c._setattr('sub.b1', True, force_permissive=True) + assert str(setting[b1]) == "['test']" diff --git a/tiramisu/setting.py b/tiramisu/setting.py index 38cf7b5..e2ddb7d 100644 --- a/tiramisu/setting.py +++ b/tiramisu/setting.py @@ -392,7 +392,7 @@ class Settings(object): if ntime is None: ntime = int(time()) ntime = ntime + expires_time - self._p_.setcache(path, props, ntime) + self._p_.setcache(path, copy(props), ntime) return props def append(self, propname):