add extend in config setting

This commit is contained in:
Emmanuel Garette 2014-03-08 18:53:22 +01:00
parent c175519211
commit d3f9d20ab5
2 changed files with 13 additions and 0 deletions

View File

@ -310,6 +310,15 @@ def test_access_by_get_whith_hide():
raises(AttributeError, "c.find(byname='b1')") raises(AttributeError, "c.find(byname='b1')")
def test_extend_config_properties():
descr = make_description()
cfg = Config(descr)
setting = cfg.cfgimpl_get_settings()
assert str(setting) == str(['cache', 'expire', 'validator'])
setting.extend(['test', 'test2'])
assert str(setting) == str(['test', 'cache', 'test2', 'expire', 'validator'])
def test_append_properties(): def test_append_properties():
descr = make_description() descr = make_description()
cfg = Config(descr) cfg = Config(descr)

View File

@ -408,6 +408,10 @@ class Settings(object):
props.remove(propname) props.remove(propname)
self._setproperties(props, None, None) self._setproperties(props, None, None)
def extend(self, propnames):
for propname in propnames:
self.append(propname)
def _setproperties(self, properties, opt, path): def _setproperties(self, properties, opt, path):
"""save properties for specified opt """save properties for specified opt
(never save properties if same has option properties) (never save properties if same has option properties)