Esempio n. 1
0
 def render_str(self, template, **kwargs):
     """Render the template with the given arguments.
     :param: template:basestring: The name of the template in the templates directory.
     :param: kwargs:named variables to be used on the page.
     :return: The template rendered with the named arguments.
     """
     template = jinja_env.get_template(template)
     return template.render(**kwargs)
Esempio n. 2
0
 def prepare_response(self, template_path, **kwargs):
     temp = jinja_env.get_template(template_path)
     self.response.write(temp.render(kwargs))
Esempio n. 3
0
 def render_response(self, template, context=None):
   import os
   if context is None:
     return self.response.out.write(jinja_env.get_template(template).render())
   else:
     return self.response.out.write(jinja_env.get_template(template).render(context))
Esempio n. 4
0
 def render_str(self, template, **params):
     t = jinja_env.get_template(template)
     return t.render(params)