appsettings.py

Application settings manager.

class clay.settings._Settings[source]

Settings management class.

__init__()[source]

x.__init__(…) initializes x; see help(type(x)) for signature

__weakref__

list of weak references to the object (if defined)

_commit_edits(config)[source]

Write config to file.

This method is supposed to be called only from __exit__().

_ensure_directories()[source]

Create config dir, config file & cache dir if they do not exist yet.

_load_cache()[source]

Load cached files.

_load_config()[source]

Read config from file.

edit()[source]

Return _SettingsEditor context manager to edit config.

Settings are saved to file once the returned context manager exists.

Example usage:

from clay.settings import settings

with settings.edit() as config:
    config['foo']['bar'] = 'baz'
get(key, *sections)[source]

Return their configuration key in a specified section By default it looks in play_settings.

get_cached_file_path(filename)[source]

Get full path to cached file.

get_default_config_section(*sections)[source]

Always get a section from the default/system configuration. You would use this whenever you need to loop through all the values in a section. In the user config they might be incomplete.

get_is_file_cached(filename)[source]

Return True if filename is present in cache.

get_section(*sections)[source]

Get a section from the user configuration file if it can find it, else load it from the system config

save_file_to_cache(filename, content)[source]

Save content into file in cache.

class clay.settings._SettingsEditor(original_config, commit_callback)[source]

Thread-safe settings editor context manager.

For example see edit().

__init__(original_config, commit_callback)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

__weakref__

list of weak references to the object (if defined)