Part of config View In Hierarchy
Method | __init__ | Initialize the config class and load a config |
Method | get | get an option and set the default value, if the option is unset. |
Method | has | test, in which networks/channels a option is set. |
Method | set | Undocumented |
Method | delete |
>>> c=config()
|
Method | getNetworks | Undocumented |
Method | getChannels | Undocumented |
Method | exportyaml | Undocumented |
Method | setConfig | Undocumented |
Method | delConfig | Undocumented |
Method | hasConfig | Undocumented |
Method | getConfig | Undocumented |
Method | getPathConfig | Undocumented |
Method | getBoolConfig |
>>> c=config()
|
Method | writeConfig | Undocumented |
get an option and set the default value, if the option is unset. @param set_default if True, the default will be set in the config, if its used. if False, the default will be returned, but the config will not be changed. >>> c=config() >>> c.get("option", "default") 'default' >>> c.get("option", "unset?") 'default'
test, in which networks/channels a option is set. Returns a tuple: (general_bool, network_list, (network, channel) list)
>>> c=config() >>> c.has("testkey") (False, [], []) >>> c.set("testkey", "testvalue") >>> c.has("testkey") (True, [], []) >>> c.set("testkey", "othervalue", network="samplenetwork") >>> c.has("testkey") (True, ['samplenetwork'], [])
>>> c=config() >>> c.set("key", "value") >>> c.get("key", "unset") 'value' >>> c.delete("key") >>> c.get("key", "unset") 'unset'
>>> c=config() >>> c.set("key", "1") >>> c.set("key2", "on") >>> c.set("key3", "True") >>> c.getBoolConfig("key") and c.getBoolConfig("key2") and c.getBoolConfig("key3") True >>> c.set("key", "False") >>> c.set("key2", "any string which is not in [True, true, on, On, 1]") >>> c.getBoolConfig("key") or c.getBoolConfig("key2") False