class documentation
class configService(service.Service): (source)
Undocumented
Method | __init__ |
Initialize the config class and load a config |
Method | del |
Undocumented |
Method | delete |
No summary |
Method | get |
get an option and set the default value, if the option is unset. |
Method | get |
No summary |
Method | get |
Undocumented |
Method | get |
Undocumented |
Method | get |
Undocumented |
Method | get |
Undocumented |
Method | has |
Test, in which networks/channels a option is set. Returns a tuple: (general_bool, network_list, (network, channel) list) |
Method | has |
Undocumented |
Method | set |
Undocumented |
Method | set |
Undocumented |
Method | start |
Undocumented |
Method | stop |
Undocumented |
Method | write |
Undocumented |
Instance Variable | filename |
Undocumented |
Instance Variable | generic |
Undocumented |
Instance Variable | generic |
Undocumented |
Instance Variable | logger |
Undocumented |
Instance Variable | name |
Undocumented |
Instance Variable | network |
Undocumented |
Method | _create |
create preceding dictionary entries for network/channel options |
>>> c=configService() >>> c.set("key", "value") >>> c.get("key", "unset") 'value' >>> c.delete("key") >>> c.get("key", "unset") 'unset'
def get(self, option, default, module=None, network=None, channel=None, set_default=True):
(source)
¶
get an option and set the default value, if the option is unset.
>>> c=configService() >>> c.get("option", "default") 'default' >>> c.get("option", "unset?") 'default'
Parameters | |
option | Undocumented |
default | Undocumented |
module | Undocumented |
network | Undocumented |
channel | Undocumented |
set | 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=configService() >>> c.set("key", "1") >>> c.set("key2", "on") >>> c.set("key3", "True") >>> c.getBool("key") and c.getBool("key2") and c.getBool("key3") True >>> c.set("key", "False") >>> c.set("key2", "any string which is not in [True, true, on, On, 1]") >>> c.getBool("key") or c.getBool("key2") False
def getConfig(self, option, defaultvalue='', module=None, network=None, channel=None, set_default=True):
(source)
¶
Undocumented
def getPath(self, option, datadir, defaultvalue='', module=None, network=None, channel=None):
(source)
¶
Undocumented
Test, in which networks/channels a option is set. Returns a tuple: (general_bool, network_list, (network, channel) list)
>>> c=configService() >>> c.has("testkey") (False, [], []) >>> c.set("testkey", "testvalue") >>> c.has("testkey") (True, [], []) >>> c.set("testkey", "othervalue", network="samplenetwork") >>> c.has("testkey") (True, ['samplenetwork'], [])
def set(self, option, value, module=None, network=None, channel=None, still_default=False):
(source)
¶
Undocumented
create preceding dictionary entries for network/channel options
>>> c=configService() >>> c.network_options {} >>> c._create_preceding("samplenetwork", "#samplechannel") >>> c.network_options {'samplenetwork': {'#samplechannel': {}}} >>> c._create_preceding("othernetwork") >>> c.network_options {'othernetwork': {}, 'samplenetwork': {'#samplechannel': {}}}