API documentation

confmodel module

The top-level namespace contains some convenience imports.

Members

__version__

Version number.

class Config(config_data, static=False)

Config object.

Configuration options:

post_validate()

Subclasses may override this to provide cross-field validation.

Implementations should raise ConfigError if the configuration is invalid (by calling raise_config_error(), for example).

raise_config_error(message)

Raise a ConfigError with the given message.

confmodel.errors module

Exception classes used in confmodel.

Members

exception ConfigError[source]

Bases: exceptions.Exception

Base exception class for config-related errors.

confmodel.interfaces module

Interfaces used in confmodel.

Members

interface IConfigData[source]

Interface for a config data provider.

This provides read-only access to some configuration data provider. The simplest implementation is a vanilla dict.

__contains__(field_name)[source]

Check for the existence of a config field.

This is identical to has_key() but is often more convenient to use.

Parameters:field_name (str) – The name of the field to look up.
Returns:True if a value exists for the given field_name, False otherwise.
has_key(field_name)[source]

Check for the existence of a config field.

Parameters:field_name (str) – The name of the field to look up.
Returns:True if a value exists for the given field_name, False otherwise.
get(field_name, default)[source]

Get the value of a config field.

Parameters:
  • field_name (str) – The name of the field to look up.
  • default – The value to return if the requested field is not found.
Returns:

The value for the given field_name, or default if the field has not been specified.