Source code for invenio_config_iform.ext
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020-2024 Graz University of Technology.
#
# invenio-config-iform 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 module that adds I-Form configs."""
from flask import Flask
from . import config
from .custom_fields import ip_network, single_ip
[docs]
def finalize_app(app: Flask) -> None:
"""Finalize app."""
rank_blueprint_higher(app)
[docs]
def rank_blueprint_higher(app: Flask) -> None:
"""Rank this module's blueprint higher than blueprint of security module.
Needed in order to overwrite email templates.
Since the blueprints are in a dict and the order of insertion is
retained, popping and reinserting all items (except ours), ensures
our blueprint will be in front.
"""
bps = app.blueprints
for blueprint_name in list(bps.keys()):
if blueprint_name != "invenio_config_iform":
bps.update({blueprint_name: bps.pop(blueprint_name)})