Exemplo n.º 1
0
 def render_template(self, req, context):
     if self.template.endswith((".j2.jade", ".j2.html")):
         template_path = os.path.join("styles", self.template)
         return render_template(template_path, **context)
     else:
         template_path = os.path.join(self.path, self.template)
         return tal.getTAL(template_path, context, request=req)
Exemplo n.º 2
0
 def render_template(self, template_name, context):
     if template_name.endswith((".j2.jade", ".j2.html")):
         # caller wants a jinja template
         return render_template(template_name, **context)
     elif template_name.endswith(".html"):
         # caller wants a TAL template
         tal_template = self.get_tal_template_path(template_name)
         return tal.getTAL(tal_template, context)
     else:
         raise TemplateNotFound(
             "invalid template name (must end with .j2.jade, .j2.html or .html): "
             + template_name)
Exemplo n.º 3
0
 def render_template(self, req, context):
     template_path = os.path.join("styles", self.template)
     return render_template(template_path, **context)