add extend in config setting
authorEmmanuel Garette <egarette@cadoles.com>
Sat, 8 Mar 2014 17:53:22 +0000 (18:53 +0100)
committerEmmanuel Garette <egarette@cadoles.com>
Sat, 8 Mar 2014 17:53:22 +0000 (18:53 +0100)
test/test_option_setting.py
tiramisu/setting.py

index 94755e8..28327d5 100644 (file)
@@ -310,6 +310,15 @@ def test_access_by_get_whith_hide():
     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():
     descr = make_description()
     cfg = Config(descr)
index e2ddb7d..d3b0a3b 100644 (file)
@@ -408,6 +408,10 @@ class Settings(object):
             props.remove(propname)
             self._setproperties(props, None, None)
 
+    def extend(self, propnames):
+        for propname in propnames:
+            self.append(propname)
+
     def _setproperties(self, properties, opt, path):
         """save properties for specified opt
         (never save properties if same has option properties)