5.3.1 conf

The aspen.conf object is an instance of aspen._configuration.ConfFile, which subclasses the standard library's ConfigParser.RawConfigParser class to represent the __/etc/aspen.conf file. In addition to the RawConfigParser API, the object supports both attribute and key read-only access; either returns a dictionary corresponding to a section of the aspen.conf file. If the named section does not exist, an empty dictionary is returned.

Your application is free and encouraged to use the aspen.conf file for it's own configuration, and to access that information via this object.

To illustrate, here is a minimal aspen.conf file:

[my_settings]
foo = bar

Such a file could support code like this:

import aspen

def wsgi_app(environ, start_response):
    my_setting = aspen.conf.my_settings.get('foo', 'default')
    start_response('200 OK', [])
    return ["My setting is %s" % my_setting]

See Also:

RawConfigParser
In addition to the API above, aspen.conf also exposes the RawConfigParser API.

Aspen is copyright © 2006-2007 by Chad Whitacre and contributors, and is offered under the MIT license.