Pluggdapps

Component system. Web framework. And more ...

config – Library functions for configuration settings.

Utility functions and classes to describe configuration settings for plugins and process them.

Module contents

class pluggdapps.utils.config.ConfigDict(*args, **kwargs)[source]

A collection of configuration settings. When a fresh key, a.k.a configuration parameter is added to this dictionary, it can be provided as ConfigItem object or as a dictionary containing key,value pairs similar to ConfigItem.

Used as return type for default_settings() method specified in pluggdapps.plugin.ISettings

class pluggdapps.utils.config.ConfigItem(*args, **kwargs)[source]

Convenience class to encapsulate config parameter description, which is a dictionary of following keys,

default,
Default value for this settings a.k.a configuration parameter. Compulsory field.
types,
Either a tuple of valid types, or a string of comma separated values. Allowed types are, str, int, bool, csv. Compulsory field.
help,
Help string describing the purpose and scope of settings parameter. Compulsory field.
webconfig,
Boolean, specifying whether the settings parameter is configurable via web. Optional field. Default is True.
options,
List of optional values that can be used for configuring this parameter. Optional field.
pluggdapps.utils.config.settingsfor(prefix, sett)[source]

Filter settings keys sett.keys() starting with prefix and return a dictionary of corresponding options. Prefix is pruned of from returned settings’ keys.

pluggdapps.utils.config.plugin2sec(pluginname)[source]

Convert pluginname to plugin section name in ini-file. For Eg, for plugin-name httpepollserver, will return plugin:httpepollserver.

pluggdapps.utils.config.sec2plugin(secname)[source]

Reverse of plugin2sec().

pluggdapps.utils.config.is_plugin_section(secname)[source]

Check whether secname starts with plugin:.