__init__.py 774 Bytes
Newer Older
1 2
#!/usr/bin/env python3
from pathlib import Path
3
from urllib.parse import quote_plus
4

5 6
import flask
import jinja2
7

8
import validata_core
9
from validata_ui.validate_helper import ValidatorHelper
10 11

# Schemas settings
Pierre Dittgen's avatar
Pierre Dittgen committed
12
schemas_config = validata_core.get_schemas_config()
Christophe Benz's avatar
Christophe Benz committed
13
ValidatorHelper.init(schemas_config)
14 15

# Flask things
16
app = flask.Flask(__name__)
17 18
app.secret_key = 'MyPr3ci0u5$€cr€t'

19 20 21 22 23 24 25 26 27 28 29
# Jinja2 url_quote_plus custom filter
# https://stackoverflow.com/questions/12288454/how-to-import-custom-jinja2-filters-from-another-file-and-using-flask
blueprint = flask.Blueprint('filters', __name__)

@jinja2.contextfilter
@blueprint.app_template_filter()
def urlencode(context, value):
    return quote_plus(value)


# Let this import after app initialisation
30
import validata_ui.views