From 2bf9d377263a59368fd0e79e30525ad6cc7971dc Mon Sep 17 00:00:00 2001 From: fbraem Date: Thu, 26 Dec 2024 14:45:06 +0100 Subject: [PATCH] fix: remove template path --- backend/src/kwai/core/events/dependencies.py | 3 ++- backend/src/kwai/core/template/dependency.py | 11 ----------- backend/src/tests/conftest.py | 2 +- 3 files changed, 3 insertions(+), 13 deletions(-) delete mode 100644 backend/src/kwai/core/template/dependency.py diff --git a/backend/src/kwai/core/events/dependencies.py b/backend/src/kwai/core/events/dependencies.py index a2ec5f694..b1edabd9d 100644 --- a/backend/src/kwai/core/events/dependencies.py +++ b/backend/src/kwai/core/events/dependencies.py @@ -1,4 +1,5 @@ """Module that defines the dependencies for events.""" + import contextlib from typing import AsyncGenerator @@ -27,7 +28,7 @@ async def create_database(settings: Settings) -> AsyncGenerator[Database, None]: @inject.autoparams() def create_template_engine(settings: Settings) -> TemplateEngine: """Create the template engine dependency.""" - return Jinja2Engine(settings.template.path, website=settings.website) + return Jinja2Engine(website=settings.website) @inject.autoparams() diff --git a/backend/src/kwai/core/template/dependency.py b/backend/src/kwai/core/template/dependency.py deleted file mode 100644 index 8662a98e8..000000000 --- a/backend/src/kwai/core/template/dependency.py +++ /dev/null @@ -1,11 +0,0 @@ -"""Module that defines a dependency for a template engine.""" -from fastapi import Depends - -from kwai.core.settings import get_settings -from kwai.core.template.jinja2_engine import Jinja2Engine -from kwai.core.template.template_engine import TemplateEngine - - -def get_template_engine(settings=Depends(get_settings)) -> TemplateEngine: - """Get the template engine.""" - return Jinja2Engine(settings.template_path, website=settings.website.dict()) diff --git a/backend/src/tests/conftest.py b/backend/src/tests/conftest.py index 9a8a69057..3e0318f12 100644 --- a/backend/src/tests/conftest.py +++ b/backend/src/tests/conftest.py @@ -101,7 +101,7 @@ def recipients() -> Recipients: def template_engine() -> TemplateEngine: """Fixture for getting a template engine.""" settings = get_settings() - return Jinja2Engine(settings.template.path, website=settings.website) + return Jinja2Engine(website=settings.website) @pytest.fixture(scope="module")