libbe.storage.util.config

Create, save, and load the per-user config file at path().

libbe.storage.util.config.default_encoding = 'UTF-8'

Default filesystem encoding.

Initialized with libbe.util.encoding.get_text_file_encoding().

libbe.storage.util.config.get_val(name, section='DEFAULT', default=None, encoding=None)

Get a value from the per-user config file

Parameters :

name : str

The name of the value to set.

section : str

The section to store the name/value in.

default : :

The value to return if name is not set.

encoding : str

The config file’s encoding, defaults to default_encoding.

Examples

>>> get_val("junk") is None
True
>>> set_val("junk", "random")
>>> get_val("junk")
u'random'
>>> set_val("junk", None)
>>> get_val("junk") is None
True
libbe.storage.util.config.path()

Return the path to the per-user config file.

Defaults to ~/.config/bugs-everywhere, but you can override the directory with XDG_CONFIG_HOME from the XDG Base Directory Specification. You can also override the entire path by setting the BE_CONFIG_PATH environment variable.

libbe.storage.util.config.set_val(name, value, section='DEFAULT', encoding=None)

Set a value in the per-user config file.

Parameters :

name : str

The name of the value to set.

value : str or None

The new value to set (or None to delete the value).

section : str

The section to store the name/value in.

encoding : str

The config file’s encoding, defaults to default_encoding.

Previous topic

libbe.storage.util

Next topic

libbe.storage.util.mapfile

This Page