__init__.py 751 Bytes
Newer Older
1
from pathlib import Path
2
from urllib.parse import quote_plus
3

4 5
import flask
import jinja2
6

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

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

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

18 19 20 21 22 23 24 25 26 27 28
# 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
29
import validata_ui.views