Skip to content

5.6.0

Choose a tag to compare

@CheeseCake87 CheeseCake87 released this 04 Feb 20:52
· 117 commits to main since this release

New method added to register ImpBlueprints: imp.register_imp_blueprint

from flask import Flask

from flask_imp import Imp

imp = Imp()

DO_IMPORT = True


def create_app():
    app = Flask(__name__)
    imp.init_app(app)

    if DO_IMPORT:
        from app.my_blueprint import bp

        imp.register_imp_blueprint(bp)

    return app

Addition of two new decorators @checkpoint and @api_checkpoint these will eventually replace login_check, api_login_check and permission_check

The intention is the it's part of the security package, and they are security.checkpoint - s of which you can have multiple.

@bp.route("/admin", methods=["GET"])
@checkpoint(
    'logged_in',
    True,
    fail_endpoint='blueprint.login_page',
    message="Login needed"
)
@checkpoint(
    'user_type',
    'admin',
    fail_endpoint='blueprint.index',
    message="You need to be an admin to access this page"
)
def admin_page():
    ...