def _find_db_ext():
"""Find the current ORM Extension this App is using.
After we discover and initialize the proper ORM Extension we need the
``db`` proxy to resolve to it, which is exactly what this method does here.
Does this by simply inspecting a global, but that could be done better.
Returns:
flask_utils.FlaskDB|flask_sqlalchemy.SQLAlchemy: The correct and
current ORM Extension in use for this App.
"""
if _SELECTED_BACKEND is MISSING:
# @TODO: Do like Flask does with the context error and have a single
# leading line that sort of explains the issue and is easily searched?
raise RuntimeError("You have attempted to use the Fleaker DB proxy "
"before it was initialized! Please ensure you are "
"in the right context or push it yourself! Please "
"see the documentation for more information!")
return _SELECTED_BACKEND
评论列表
文章目录