This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
mandaye/mandaye/template.py

15 lines
408 B
Python

from mako.lookup import TemplateLookup
from mako.template import Template
from mandaye import config
mylookup = TemplateLookup(directories=[config.template_directory],
input_encoding='utf-8')
def serve_template(templatename, **kwargs):
""" serve a template
"""
mytemplate = mylookup.get_template(templatename)
return mytemplate.render_unicode(**kwargs).encode('utf-8', 'replace')