pology.config.section

pology :: config :: section :: Class section |

# Class section

Section of the configuration.

All getter methods take the field name and the default value, which is returned when the field is not set. If the configuration field is set but cannot be converted into a value of requested type, execution aborts with an error message.

Instance Methods
__init__(self, name) Retrieve a section of the configuration. |
set(string) |
fields(self) Get all configuration field names in this section. |
unicode or as `default` |
string(self, name, default=None) Get a configuration field as a string. |
int or as `default` |
integer(self, name, default=None) Get a configuration field as an integer number. |
float or as `default` |
real(self, name, default=None) Get a configuration field as a real number. |
bool or as `default` |
boolean(self, name, default=None) Get a configuration field as a boolean. |
unicode or as `default` |
strslist(self, name, default=None, sep=`'``,``'`) Get a configuration field as a list of separated strings. |
unicode or as `default` |
strdlist(self, name, default=None) Get a configuration field as a list of delimited strings. |

Instance Variables
string | name name of the section

Method Details

### __init__(self, name) (Constructor) |
Retrieve a section of the configuration. Constructed section object is valid even when the configuration does not contain the requested section (in that case, all field queries on the section are going to return default values). Parameters: `name` (string) - name of the section

### strslist(self, name, default=None, sep=`'``,``'`) |
Get a configuration field as a list of separated strings. Separator character or string is used to split the field value into substrings:
       afield = foo, bar, baz
Leading and trailing whitespace in list elements is stripped. If list elements should be able to contain any characters or whitespace is significant, use delimited list instead (strdlist). Parameters: `sep` (string) - the separator Returns: unicode or as `default`

### strdlist(self, name, default=None) |
Get a configuration field as a list of delimited strings. Delimiter is taken to be the non-alphanumeric character with which the field value starts. In this example:
       afield = /foo/bar/baz/
the delimiter is `/`. If the field value does not start with a non-alphanumeric, or it does not end with the delimiter, error is signalled. Returns: unicode or as `default`