mirror of https://github.com/kianby/stacosys
use enums
parent
acaae53982
commit
8ee07ec9ed
@ -1,22 +1,22 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from enum import Enum
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
|
|
||||||
|
|
||||||
class Templater:
|
class Template(Enum):
|
||||||
def __init__(self, template_path):
|
|
||||||
self._env = Environment(loader=FileSystemLoader(template_path))
|
|
||||||
|
|
||||||
def get_template(self, lang, name):
|
|
||||||
return self._env.get_template(lang + "/" + name + ".tpl")
|
|
||||||
|
|
||||||
|
|
||||||
class Template:
|
|
||||||
DROP_COMMENT = "drop_comment"
|
DROP_COMMENT = "drop_comment"
|
||||||
APPROVE_COMMENT = "approve_comment"
|
APPROVE_COMMENT = "approve_comment"
|
||||||
NEW_COMMENT = "new_comment"
|
NEW_COMMENT = "new_comment"
|
||||||
NOTIFY_MESSAGE = "notify_message"
|
NOTIFY_MESSAGE = "notify_message"
|
||||||
RSS_TITLE_MESSAGE = "rss_title_message"
|
RSS_TITLE_MESSAGE = "rss_title_message"
|
||||||
|
|
||||||
|
|
||||||
|
class Templater:
|
||||||
|
def __init__(self, template_path):
|
||||||
|
self._env = Environment(loader=FileSystemLoader(template_path))
|
||||||
|
|
||||||
|
def get_template(self, lang, template: Template):
|
||||||
|
return self._env.get_template(lang + "/" + template.value + ".tpl")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue