Skip to content

Feat(core): Implement file templates to UnifiedTemplate #153

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

bushmaks
Copy link
Collaborator

Привет, не совсем уверен, что можно инициализировать get_app_config в core, но прошу все равно посмотреть, фича нужна для написания jinja2 шаблонов не в строках, а в файлах. app_config нужен для настройки папки templates, не во всех проектах она нужна в references.

if input.get("file"):
from smart_kit.configs import get_app_config
app_config = get_app_config()
template_loader = FileSystemLoader(app_config.JINJA2_TEMPLATES_PATH)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Навернре jinja2.FileSystemLoader

@SyrexMinus
Copy link
Collaborator

Можете добавить пример использования фичи? Как добавить шаблон в файле? Если не трудно, сделайте сравнение до и после: в строке и в файле.

@intsynko intsynko added the enhancement New feature or request label Jan 14, 2022
Copy link
Collaborator

@dangerink dangerink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

чтобы было универсально, нужно переделать на FileRepository - > dict -> jinja2.DictLoader

@SyrexMinus
Copy link
Collaborator

чтобы было универсально, нужно переделать на FileRepository - > dict -> jinja2.DictLoader

"это порядок загрузки. FileRepository из ceph из него получает дикт с шаблоном, его кормим в jinja2.DictLoader"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants