Removed the redundant Flask App context from the default_currency_code Jinja2 global and the default_ie_account_code function. They are always under the Flask app context.

This commit is contained in:
依瑪貓 2023-03-21 21:17:10 +08:00
parent 446087b212
commit 9248ba7e3b
2 changed files with 3 additions and 5 deletions

View File

@ -71,9 +71,8 @@ def default_ie_account_code() -> str:
:return: The default account code for the income and expenses log.
"""
with current_app.app_context():
return current_app.config.get("ACCOUNTING_DEFAULT_IE_ACCOUNT",
Account.CASH_CODE)
return current_app.config.get("ACCOUNTING_DEFAULT_IE_ACCOUNT",
Account.CASH_CODE)
def default_ie_account() -> IncomeExpensesAccount:

View File

@ -35,5 +35,4 @@ def default_currency_code() -> str:
:return: The default currency code.
"""
with current_app.app_context():
return current_app.config.get("ACCOUNTING_DEFAULT_CURRENCY", "USD")
return current_app.config.get("ACCOUNTING_DEFAULT_CURRENCY", "USD")