From c984d2d5963927234ef8d8c27386e1fad0cead62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Sat, 8 Apr 2023 07:11:41 +0800 Subject: [PATCH] Renamed the IncomeExpensesAccountConverter path converter to CurrentAccountConverter. --- src/accounting/report/__init__.py | 4 ++-- src/accounting/report/converters.py | 6 +++--- src/accounting/report/views.py | 7 +++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/accounting/report/__init__.py b/src/accounting/report/__init__.py index b111ea3..3ea2af0 100644 --- a/src/accounting/report/__init__.py +++ b/src/accounting/report/__init__.py @@ -27,9 +27,9 @@ def init_app(app: Flask, url_prefix: str) -> None: :param url_prefix: The URL prefix of the accounting application. :return: None. """ - from .converters import PeriodConverter, IncomeExpensesAccountConverter + from .converters import PeriodConverter, CurrentAccountConverter app.url_map.converters["period"] = PeriodConverter - app.url_map.converters["ieAccount"] = IncomeExpensesAccountConverter + app.url_map.converters["currentAccount"] = CurrentAccountConverter from .views import bp as report_bp app.register_blueprint(report_bp, url_prefix=url_prefix) diff --git a/src/accounting/report/converters.py b/src/accounting/report/converters.py index f51a58c..3a72fee 100644 --- a/src/accounting/report/converters.py +++ b/src/accounting/report/converters.py @@ -51,9 +51,9 @@ class PeriodConverter(BaseConverter): return value.spec -class IncomeExpensesAccountConverter(BaseConverter): - """The converter to convert the income and expenses log account code from - and to the corresponding account in the routes.""" +class CurrentAccountConverter(BaseConverter): + """The converter to convert the current account code from and to the + corresponding account in the routes.""" def to_python(self, value: str) -> CurrentAccount: """Converts an account code to an account. diff --git a/src/accounting/report/views.py b/src/accounting/report/views.py index 88d0e14..e13626d 100644 --- a/src/accounting/report/views.py +++ b/src/accounting/report/views.py @@ -125,7 +125,7 @@ def __get_ledger(currency: Currency, account: Account, period: Period) \ return report.html() -@bp.get("income-expenses//", +@bp.get("income-expenses//", endpoint="income-expenses-default") @has_permission(can_view) def get_default_income_expenses(currency: Currency, account: CurrentAccount) \ @@ -139,9 +139,8 @@ def get_default_income_expenses(currency: Currency, account: CurrentAccount) \ return __get_income_expenses(currency, account, get_period()) -@bp.get( - "income-expenses///", - endpoint="income-expenses") +@bp.get("income-expenses///" + "", endpoint="income-expenses") @has_permission(can_view) def get_income_expenses(currency: Currency, account: CurrentAccount, period: Period) -> str | Response: