This document contains details about the option attributes and option types included in configglue.
See also
If the built-in options don’t do the trick, you can easily write your own custom schema options.
The following arguments are available to all option types. All are optional.
The name of the option. This will be automatically set to the name assigned to the option in the schema definition.
If True, variable interpolation will not be carried out for this option.
Default is False.
The default value for this option, if none is provided in the config file.
Default is configglue.schema.NO_DEFAULT.
If True, SchemaConfigParser.parse_all will raise an exception if no value is provided in the configuration file for this option. Otherwise, self.default will be used.
Default is False.
A list of items.
Required.
List elements will be parsed as being of this type. Should be an instance of a subclass of Option.
Optional.
If True, duplicate elements will be removed from the parsed value.
New in version 1.0.
Optional.
The value for this option can be specified as a json string representing the list.
Parsing will be attempted as if the value is a json string; if it fails, or the json string doesn’t represent a list, the original semantics will be applied (ie, the value is interpreted as a newline-separated string).
If False, no attempt is made at trying to parse the value as a json string.
A string.
Optional.
If True, a value of ‘None’ will be parsed into None instead of just leaving it as the string ‘None’.
A tuple of elements.
Optional.
If not 0, the tuple has to have exactly this number of elements.
A dictionary.
Optional.
If not None, should be a dict instance, such that its values are instances of a subclass of Option.
Optional.
If True, no keys will be allowed other than those specified in the spec.
Optional.
Any not explicitly defined attributes will be parsed as being of this type. This should be an instance of a subclass of Option.
New in version 1.0.
Optional.
The value for this option can be specified as a json string representing the dictionary.
Parsing will be attempted as if the value is a json string; if it fails, or the json string doesn’t represent a dictionary, the original semantics will be applied (ie, the value represents the name of a section defining the dictionary).
If False, no attempt is made at trying to parse the value as a json string.