API Docs

Loaders

Invenio default configuration.

invenio_config.default.ALLOWED_HTML_ATTRS = {'*': ['class'], 'a': ['href', 'title', 'name', 'class', 'rel'], 'abbr': ['title'], 'acronym': ['title']}

Allowed attributes used for html sanitizing by bleach.

invenio_config.default.ALLOWED_HTML_TAGS = ['a', 'abbr', 'acronym', 'b', 'blockquote', 'br', 'code', 'div', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'i', 'li', 'ol', 'p', 'pre', 'span', 'strike', 'strong', 'sub', 'sup', 'u', 'ul']

Allowed tags used for html sanitizing by bleach.

class invenio_config.default.InvenioConfigDefault(app=None)[source]

Load configuration from module.

New in version 1.0.0.

Initialize extension.

init_app(app)[source]

Initialize Flask application.

Invenio environment configuration.

class invenio_config.env.InvenioConfigEnvironment(app=None, prefix='INVENIO_')[source]

Load configuration from environment variables.

New in version 1.0.0.

Initialize extension.

init_app(app)[source]

Initialize Flask application.

Invenio entry point module configuration.

class invenio_config.entrypoint.InvenioConfigEntryPointModule(app=None, entry_point_group='invenio_config.module')[source]

Load configuration from module defined by entry point.

Configurations are loaded in alphabetical ascending order, meaning that an entry point named 00_name will be loaded first and an entry point named 10_name will be loaded as last. This ensures that configurations defined in 10_name app override configurations defined in 00_name app.

New in version 1.0.0.

Initialize extension.

init_app(app)[source]

Initialize Flask application.

Invenio instance folder configuration.

class invenio_config.folder.InvenioConfigInstanceFolder(app=None)[source]

Load configuration from py file in folder.

If the application have instance relative config then the file will be read from the instance folder, otherwise it will be read from the application root path.

More about instance folders.

New in version 1.0.0.

Initialize extension.

init_app(app)[source]

Initialize Flask application.

Invenio module configuration.

class invenio_config.module.InvenioConfigModule(app=None, module=None)[source]

Load configuration from module.

New in version 1.0.0.

Initialize extension.

init_app(app)[source]

Initialize Flask application.

Utilities

Default configuration loader usable by e.g. Invenio-Base.

invenio_config.utils.create_conf_loader(*args, **kwargs)[source]

Create a default configuration loader.

Deprecated since version 1.0.0b1: Use create_config_loader() instead. This function will be removed in version 1.0.1.

invenio_config.utils.create_config_loader(config=None, env_prefix='APP')[source]

Create a default configuration loader.

A configuration loader takes a Flask application and keyword arguments and updates the Flask application’s configuration as it sees fit.

This default configuration loader will load configuration in the following order:

  1. Load configuration from invenio_config.module entry points group, following the alphabetical ascending order in case of multiple entry points defined. For example, the config of an app with entry point name 10_app will be loaded after the config of an app with entry point name 00_app.
  2. Load configuration from config module if provided as argument.
  3. Load configuration from the instance folder: <app.instance_path>/<app.name>.cfg.
  4. Load configuration keyword arguments provided.
  5. Load configuration from environment variables with the prefix env_prefix.

If no secret key has been set a warning will be issued.

Parameters:
  • config – Either an import string to a module with configuration or alternatively the module itself.
  • env_prefix – Environment variable prefix to import configuration from.
Returns:

A callable with the method signature config_loader(app, **kwargs).

New in version 1.0.0.