'getattr' in optiondescription can return a bound method
This commit is contained in:
parent
7c8164090a
commit
6d8137160c
3 changed files with 15 additions and 4 deletions
|
@ -331,3 +331,16 @@ def test_config_str():
|
||||||
cfg.read_only()
|
cfg.read_only()
|
||||||
str(cfg)
|
str(cfg)
|
||||||
str(cfg.o)
|
str(cfg.o)
|
||||||
|
|
||||||
|
|
||||||
|
def test_config_od_function():
|
||||||
|
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||||
|
gcdummy1 = BoolOption('dummy1', 'dummy', default=False, properties=('disabled',))
|
||||||
|
o = OptionDescription('o', '', [gcdummy, gcdummy1])
|
||||||
|
descr = OptionDescription('tiramisu', '', [o])
|
||||||
|
cfg = Config(descr)
|
||||||
|
try:
|
||||||
|
print cfg.impl_get_opt_by_path()
|
||||||
|
except AttributeError, err:
|
||||||
|
assert str(err) == _('unknown Option {0} in OptionDescription {1}'
|
||||||
|
'').format('impl_get_opt_by_path', descr._name)
|
||||||
|
|
|
@ -98,7 +98,6 @@ def test_deref_option_config():
|
||||||
assert w() is None
|
assert w() is None
|
||||||
|
|
||||||
|
|
||||||
#FIXME rien a voir mais si je fais un config.impl_get_path_by_opt() ca me retourne la methode !
|
|
||||||
def test_deref_optiondescription_config():
|
def test_deref_optiondescription_config():
|
||||||
b = BoolOption('b', '')
|
b = BoolOption('b', '')
|
||||||
o = OptionDescription('od', '', [b])
|
o = OptionDescription('od', '', [b])
|
||||||
|
@ -109,8 +108,7 @@ def test_deref_optiondescription_config():
|
||||||
del(o)
|
del(o)
|
||||||
assert w() is not None
|
assert w() is not None
|
||||||
del(c)
|
del(c)
|
||||||
#FIXME
|
assert w() is None
|
||||||
#assert w() is None
|
|
||||||
|
|
||||||
|
|
||||||
def test_deref_groupconfig():
|
def test_deref_groupconfig():
|
||||||
|
|
|
@ -234,7 +234,7 @@ class SubConfig(object):
|
||||||
name, force_permissive=force_permissive)
|
name, force_permissive=force_permissive)
|
||||||
return homeconfig.getattr(name, force_permissive=force_permissive,
|
return homeconfig.getattr(name, force_permissive=force_permissive,
|
||||||
validate=validate)
|
validate=validate)
|
||||||
opt_or_descr = getattr(self.cfgimpl_get_description(), name)
|
opt_or_descr = self.cfgimpl_get_description().__getattr__(name)
|
||||||
if self._impl_path is None:
|
if self._impl_path is None:
|
||||||
subpath = name
|
subpath = name
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue