def _call(fn):
def call(fn, data=None):
    def bytesbuf_to_str(s):
    def escape_quotes(s):
    def break_strings(N, m):
    def nrep_string_expr(s, m=64):
def authenticated():
def api_error_handler(error): def index(): def create_new_deposit():
def index():
def data():
def metadata():
def submit():
def thankyou(): def index():
def csrf_error(e):
def access_forbidden(e):
def page_not_found(e):
def internal_error(e): def index():
def get_categories():
def get_subcategories():
def get_users():
def group_create():
def group_update():
def group_delete():
def user_create():
def user_update():
def user_delete(): def index():
def get_intake_study_permissions(study_id):
def get_dataset_detail_view():
def export():
def reports(): def index():
def download():
    def read_file_chunks(path):
def build_object_path(path, relative_path, filename):
def upload_get():
def upload_post():
def form():
    READ_BUFFER_SIZE = 1024 * io.DEFAULT_BUFFER_SIZE def index(): def index():
def get_tiers():
def get_resource_details():
def export(): def gate():
def login():
def logout():
def notifications():
def settings():
def data_access():
def callback():
    def token_request():
    def userinfo_request(token):
def should_redirect_to_oidc(username):
def oidc_authorize_url(username):
def irods_login(username, password):
def escape_irods_pam_password(password):
def original_destination():
def prepare_user():
def release_session(response):
    class UserinfoSubMismatchError(Exception): def index():
def download():
    def read_file_chunks(path):
def form():
def access():
def metadata(reference):
    READ_BUFFER_SIZE = 1024 * io.DEFAULT_BUFFER_SIZE
from os import path
from flask import Flask, g, redirect, request, send_from_directory, url_for
from flask_session import Session
from flask_wtf.csrf import CSRFProtect
from jinja2 import ChoiceLoader, FileSystemLoader
from api import api_bp
from datarequest.datarequest import datarequest_bp
from deposit.deposit import deposit_bp
from general.general import general_bp
from group_manager.group_manager import group_manager_bp
from intake.intake import intake_bp
from research.research import research_bp
from search.search import search_bp
from stats.stats import stats_bp
from user.user import user_bp
from vault.vault import vault_bp
#!/usr/bin/env python3

__copyright__ = 'Copyright (c) 2021, Utrecht University'
__license__   = 'GPLv3, see LICENSE'





app = Flask(__name__, static_folder='assets')

# Load configurations
with app.app_context():
    app.config.from_pyfile('flask.cfg')

# Add theme loader.
theme_path = path.join(app.config.get('YODA_THEME_PATH'), app.config.get('YODA_THEME'))
theme_loader = ChoiceLoader([
    FileSystemLoader(theme_path),
    app.jinja_loader,
])
app.jinja_loader = theme_loader

# Setup values for the navigation bar used in
# general/templates/general/base.html
app.config['modules'] = []

if app.config.get('RESEARCH_ENABLED'):
    app.config['modules'].append(
        {'name': 'Research', 'function': 'research_bp.index'}
    )
if app.config.get('DEPOSIT_ENABLED'):
    app.config['modules'].append(
        {'name': 'Deposit', 'function': 'deposit_bp.index'}
    )
if app.config.get('INTAKE_ENABLED'):
    app.config['modules'].append(
        {'name': 'Intake', 'function': 'intake_bp.index'}
    )
if app.config.get('DATAREQUEST_ENABLED'):
    app.config['modules'].append(
        {'name': 'Datarequest', 'function': 'datarequest_bp.index'}
    )

app.config['modules'].append(
    {'name': 'Vault', 'function': 'vault_bp.index'},
)
app.config['modules'].append(
    {'name': 'Statistics', 'function': 'stats_bp.index'},
)
app.config['modules'].append(
    {'name': 'Group Manager', 'function': 'group_manager_bp.index'},
)

app.config['modules_list'] = [module['name'] for module in app.config['modules']]

# Default nr of items in browser list
app.config['browser-items-per-page'] = 10
# Default nr of items in search list
app.config['search-items-per-page'] = 10

# Start Flask-Session
Session(app)

# Register blueprints
with app.app_context():
    app.register_blueprint(general_bp)
    app.register_blueprint(group_manager_bp, url_prefix='/group_manager')
    app.register_blueprint(research_bp, url_prefix='/research')

    app.register_blueprint(stats_bp, url_prefix='/stats')