Config Utility API

glashammer.config

This module implements the configuration. The configuration is a more or less flat thing saved as ini in the instance folder. If the configuration changes the application is reloaded automatically.

copyright:2007-2009-2008 by Armin Ronacher, Pedro Algarvio.
license:MIT
glashammer.utils.config.CONFIG_HEADER
header for the config file
class glashammer.utils.config.ConfigTransaction(cfg)

A configuration transaction class. Instances of this class are returned by Config.edit(). Changes can then be added to the transaction and eventually be committed and saved to the file system using the commit() method.

commit()
Commit the transactions. This first tries to save the changes to the configuration file and only updates the config in memory when that is successful.
revert_to_default(key)
Revert a key to the default value.
set_from_string(key, value, override=False)
Set the value for a key from a string.
update(*args, **kwargs)
Update multiple items at once.
class glashammer.utils.config.Configuration(filename)

Helper class that manages configuration values in a INI configuration file.

change_single(key, value)
Create and commit a transaction for a single key-value-pair. Return True on success, otherwise False.
changed_external
True if there are changes on the file system.
edit()
Return a new transaction object.
items()
Return a list of all key, value tuples.
iteritems()
Iterate over all keys and values.
iterkeys()
Iterate over all keys
itervalues()
Iterate over all values.
keys()
Return a list of keys.
touch()
Touch the file to trigger a reload.
values()
Return a list of values.
glashammer.utils.config.config_overriding_val(app, default, default_arg, config_key, config_type)
A value that is overridden with a default, and from the config
glashammer.utils.config.from_string(value, conv, default)
Try to convert a value from string or fall back to the default.
glashammer.utils.config.get_converter_name(conv)
Get the name of a converter
glashammer.utils.config.quote_value(value)
Quote a configuration value.
glashammer.utils.config.unquote_value(value)
Unquote a configuration value.