How to use the puppetboard.utils.jsonprint function in puppetboard

To help you get started, we’ve selected a few puppetboard examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github voxpupuli / puppetboard / puppetboard / core.py View on Github external
def get_app():
    global APP

    if APP is None:
        app = Flask(__name__)
        app.config.from_object('puppetboard.default_settings')
        app.config.from_envvar('PUPPETBOARD_SETTINGS', silent=True)
        app.secret_key = app.config['SECRET_KEY']

        numeric_level = getattr(logging, app.config['LOGLEVEL'].upper(), None)
        if not isinstance(numeric_level, int):
            raise ValueError('Invalid log level: %s' % app.config['LOGLEVEL'])

        app.jinja_env.filters['jsonprint'] = jsonprint
        app.jinja_env.filters['prettyprint'] = prettyprint
        app.jinja_env.globals['url_for_field'] = url_for_field
        app.jinja_env.globals['url_static_offline'] = url_static_offline
        APP = app

    return APP