From 644d236f97400286a24331ba48ba07cea0fc217f Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Mon, 20 Jan 2014 10:16:17 +0100 Subject: [PATCH] Document read/write of configuration variables. --- develop/advanced_plugin_config.rst | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/develop/advanced_plugin_config.rst b/develop/advanced_plugin_config.rst index 978971f..9eb2b7f 100644 --- a/develop/advanced_plugin_config.rst +++ b/develop/advanced_plugin_config.rst @@ -222,6 +222,35 @@ api keys, …):: registry.SpaceSeparatedListOfStrings('', """Contains the list of air targets.""", private=True)) + +Accessing the configuration registry +------------------------------------ + +Of course, you can access the variables in your plugins. + +If it is a variable created by your plugin, you can do it like this +(if the configuration variable's name is `air`):: + + self.registryValue('air') + +and it will return data of the right type (in this case, a list of string, +as we declarated it above as a `registry.SpaceSeparatedListOfStrings`). + +If it is a channel-specific variable, you can get the value on `#channel` +like this (if the variable is not defined on this channel, it defaults +to the global one):: + + self.registryValue('air', '#channel') + + +You can also set configuration variables (either globally or for a single +channel):: + + self.setRegistryValue('air', value=['foo', 'bar']) + self.setRegistryValue('air', value=['foo', 'bar'], channel=channel) + + self.registryValue('air') + The Built-in Registry Types =========================== A rundown of all of the built-in registry types available for use with config