Python 3.9 is now generally available.

google.appengine.api.lib_config.LibConfigRegistry

A registry containing library configuration values.

Inherits From: expected_type

modname The module name that needs to be imported.

Methods

initialize

View source

Tries to import the configuration module if it is not already imported.

This function always sets self._module to a value that is not None; either the imported module (if it was imported successfully) or a placeholder object() instance (if an ImportError was raised) is used. Other exceptions are not caught.

When a placeholder instance is used, the instance is also put in sys.modules. This usage allows us to detect when sys.modules was changed (as dev_appserver.py does when it notices source code changes) and retries the import_module in that case, while skipping it (for speed) if nothing has changed.

Args
import_func Used for dependency injection.

register

View source

Registers a set of configuration names.

Args
prefix A shared prefix for the configuration names being registered. If the prefix doesn't end in _, that character is appended.
mapping A dict that maps suffix strings to default values.

Returns
A ConfigHandle instance.

You can re-register the same prefix. When you do so, the mappings are merged, and for duplicate suffixes, the most recent registration is used.

reset

View source

Drops the imported configuration module.

If the configuration module has not been imported, no operation occurs, and the next operation takes place.