o.s.c.configService(service.Service) : class documentation

Part of otfbot.services.config View Source View In Hierarchy

No class docstring
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=configService()
Method getNetworks Undocumented
Method getChannels Undocumented
Method setConfig Undocumented
Method delConfig Undocumented
Method hasConfig Undocumented
Method getConfig Undocumented
Method getPath Undocumented
Method getBool
>>> c=configService()
Method writeConfig Undocumented
Method startService Start the service.
Method stopService Stop the service.
Method _create_preceding create preceding dictionary entries for network/channel options

Inherited from Service:

Method __getstate__ Undocumented
Method setName Set the name of the service.
Method setServiceParent Set the parent of the service.
Method disownServiceParent Use this API to remove an IService from an IServiceCollection.
Method privilegedStartService Do preparation work for starting the service.
def __init__(self, filename=None, is_subconfig=False): (source)
Initialize the config class and load a config
def _create_preceding(self, network, channel=None): (source)

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': {}}}
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'
Parametersset_defaultif 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.
def has(self, option, module=None): (source)

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
def delete(self, option, module=None, network=None, channel=None): (source)
>>> c=configService()
>>> c.set("key", "value")
>>> c.get("key", "unset")
'value'
>>> c.delete("key")
>>> c.get("key", "unset")
'unset'
def getNetworks(self): (source)
Undocumented
def getChannels(self, network): (source)
Undocumented
def setConfig(self, opt, value, module=None, network=None, channel=None): (source)
Undocumented
def delConfig(self, opt, module=None, network=None, channel=None): (source)
Undocumented
def hasConfig(self, option, module=None): (source)
Undocumented
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
def getBool(self, option, defaultvalue='', module=None, network=None, channel=None): (source)
>>> 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 writeConfig(self): (source)
Undocumented
def startService(self): (source)
Start the service.
def stopService(self): (source)
Stop the service.
Returnsa Deferred which is triggered when the service has finished shutting down. If shutting down is immediate, a value can be returned (usually, None). (type: Deferred )
API Documentation for OtfBot, generated by pydoctor at 2011-05-03 16:14:29.