Пример #1
0
 def render(self, template, context=None, status=None, mimetype=None):
     """Renders the given template (or list of templates to choose) with
     the given context using Jinja2."""
     context = context or {}
     self.response.set_status(status or DEFAULT_STATUS)
     self.response.headers['Content-type'] = mimetype or DEFAULT_MIMETYPE
     self.response.out.write(render_to_string(template, context))
Пример #2
0
 def render_to_string(self, template, context=None):
     final_context = self.default_context
     final_context.update(context or {})
     return render_to_string(template, final_context)