diff --git a/test/test_option_setting.py b/test/test_option_setting.py index 5f23796..15c8925 100644 --- a/test/test_option_setting.py +++ b/test/test_option_setting.py @@ -5,7 +5,7 @@ from py.test import raises from tiramisu.setting import owners from tiramisu.config import Config from tiramisu.option import ChoiceOption, BoolOption, IntOption, FloatOption, \ - StrOption, OptionDescription, SymLinkOption + StrOption, OptionDescription from tiramisu.error import PropertiesOptionError @@ -255,25 +255,6 @@ def test_choice_access_with_multi(): assert config.t1 == ["a", "b", "a", "b"] -#____________________________________________________________ -def test_symlink_option(): - boolopt = BoolOption("b", "", default=False) - linkopt = SymLinkOption("c", boolopt) - descr = OptionDescription("opt", "", - [linkopt, OptionDescription("s1", "", [boolopt])]) - config = Config(descr) - setattr(config, "s1.b", True) - setattr(config, "s1.b", False) - assert config.s1.b is False - assert config.c is False - config.c = True - assert config.s1.b is True - assert config.c is True - config.c = False - assert config.s1.b is False - assert config.c is False - - #____________________________________________________________ def test_accepts_multiple_changes_from_option(): s = StrOption("string", "", default="string") diff --git a/tiramisu/autolib.py b/tiramisu/autolib.py index 06a66cc..0d700c3 100644 --- a/tiramisu/autolib.py +++ b/tiramisu/autolib.py @@ -55,7 +55,7 @@ def carry_out_calculation(name, config, callback, callback_params, index=None): continue raise ConfigError(_('unable to carry out a calculation, ' 'option {0} has properties: {1} for: ' - '{2}').format(opt._name, err.proptype, + '{2}').format(path, err.proptype, name)) is_multi = opt.impl_is_multi() if is_multi: diff --git a/tiramisu/option.py b/tiramisu/option.py index 2185a7d..46ad5e9 100644 --- a/tiramisu/option.py +++ b/tiramisu/option.py @@ -761,6 +761,9 @@ class OptionDescription(BaseInformation): if isinstance(child, OptionDescription): raise ValueError(_("master group {} shall not have " "a subgroup").format(self._name)) + if isinstance(child, SymLinkOption): + raise ValueError(_("master group {} shall not have " + "a symlinkoption").format(self._name)) if not child.impl_is_multi(): raise ValueError(_("not allowed option {0} in group {1}" ": this option is not a multi" diff --git a/tiramisu/value.py b/tiramisu/value.py index 11d23cd..851b340 100644 --- a/tiramisu/value.py +++ b/tiramisu/value.py @@ -23,6 +23,7 @@ from tiramisu.error import ConfigError, SlaveError from tiramisu.setting import owners, multitypes, expires_time from tiramisu.autolib import carry_out_calculation from tiramisu.i18n import _ +from tiramisu.option import SymLinkOption class Values(object): @@ -192,6 +193,8 @@ class Values(object): self._values[opt] = (setting.getowner(), value) def getowner(self, opt): + if isinstance(opt, SymLinkOption): + opt = opt._opt owner = self._values.get(opt, (owners.default, None))[0] meta = self.context.cfgimpl_get_meta() if owner is owners.default and meta is not None: