1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
# Copyright 2021-2024 by J. Christopher Wagner (jwag). All rights reserved.
import typing as t
from flask import current_app
from werkzeug.local import LocalProxy
if t.TYPE_CHECKING: # pragma: no cover
from passlib.context import CryptContext
from .core import Security, UserDatastore
# Convenient references
_security: "Security" = LocalProxy( # type: ignore
lambda: current_app.extensions["security"]
)
_datastore: "UserDatastore" = LocalProxy( # type:ignore
lambda: _security.datastore
)
_pwd_context: "CryptContext" = LocalProxy(lambda: _security.pwd_context) # type: ignore
_hashing_context: "CryptContext" = LocalProxy( # type: ignore
lambda: _security.hashing_context
)
DecoratedView = t.Callable[..., t.Any]
|