pytest templater

This commit is contained in:
Yax 2021-01-09 19:15:58 +01:00
parent 8b38769cfc
commit 6397e547d8
2 changed files with 57 additions and 11 deletions

View file

@ -13,12 +13,15 @@ env = Environment(loader=FileSystemLoader(template_path))
TEMPLATE_DROP_COMMENT = "drop_comment"
TEMPLATE_APPROVE_COMMENT = "approve_comment"
TEMPLATE_NEW_COMMENT = "new_comment"
TEMPLATE_NOTIFY_MESSAGE = "notify_message"
TEMPLATE_RSS_TITLE_MESSAGE = "rss_title_message"
def get_template(lang, name):
return env.get_template(lang + "/" + name + ".tpl")
class Templater:
class Templater:
def __init__(self, lang, template_path):
self._env = Environment(loader=FileSystemLoader(template_path))
self._lang = lang
@ -26,4 +29,3 @@ class Templater:
def get_template(self, name):
return self._env.get_template(self._lang + "/" + name + ".tpl")