Source code for invenio_config.default

# -*- coding: utf-8 -*-
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.

"""Invenio default configuration."""

from __future__ import absolute_import, print_function

import warnings

#: Allowed tags used for html sanitizing by bleach.

#: Allowed attributes used for html sanitizing by bleach.
    '*': ['class'],
    'a': ['href', 'title', 'name', 'class', 'rel'],
    'abbr': ['title'],
    'acronym': ['title'],

[docs]class InvenioConfigDefault(object): """Load configuration from module. .. versionadded:: 1.0.0 """ def __init__(self, app=None): """Initialize extension.""" if app: self.init_app(app)
[docs] def init_app(self, app): """Initialize Flask application.""" # Ensure SECRET_KEY is set. SECRET_KEY = app.config.get('SECRET_KEY') if SECRET_KEY is None: app.config['SECRET_KEY'] = 'CHANGE_ME' warnings.warn( 'Set configuration variable SECRET_KEY with random string', UserWarning) if app.config.get('ALLOWED_HTML_TAGS') is None: app.config['ALLOWED_HTML_TAGS'] = ALLOWED_HTML_TAGS if app.config.get('ALLOWED_HTML_ATTRS') is None: app.config['ALLOWED_HTML_ATTRS'] = ALLOWED_HTML_ATTRS