Esempio n. 1
0
 def process_template_response(self, request, response):
     if hasattr(response, "template_name"):
         if not isinstance(response.template_name, Template):
             templates = templates_for_device(request,
                                              response.template_name)
             response.template_name = templates
     return response
Esempio n. 2
0
 def process_template_response(self, request, response):
     if hasattr(response, "template_name"):
         if not isinstance(response.template_name, Template):
             templates = templates_for_device(request,
                 response.template_name)
             response.template_name = templates
     return response
Esempio n. 3
0
 def process_template_response(self, request, response):
     """
     Inserts device-specific templates to the template list.
     """
     templates = templates_for_device(request, response.template_name)
     response.template_name = templates
     return response
Esempio n. 4
0
 def process_template_response(self, request, response):
     """
     Inserts device-specific templates to the template list.
     """
     templates = templates_for_device(request, response.template_name)
     response.template_name = templates
     return response
Esempio n. 5
0
 def render(self, context):
     if not getattr(self, "nodelist", False):
         try:
             request = context["request"]
         except KeyError:
             t = get_template(name)
         else:
             ts = templates_for_device(request, name)
             t = select_template(ts)
         self.nodelist = t.nodelist
     parts = [template.Variable(part).resolve(context) for part in token.split_contents()[1:]]
     if takes_context:
         parts.insert(0, context)
     result = tag_func(*parts)
     autoescape = context.autoescape
     context = context_class(result, autoescape=autoescape)
     return self.nodelist.render(context)
Esempio n. 6
0
 def render(self, context):
     if not getattr(self, "nodelist", False):
         try:
             request = context["request"]
         except KeyError:
             t = get_template(name)
         else:
             ts = templates_for_device(request, name)
             t = select_template(ts)
         self.nodelist = t.nodelist
     parts = [template.Variable(part).resolve(context)
              for part in token.split_contents()[1:]]
     if takes_context:
         parts.insert(0, context)
     result = tag_func(*parts)
     autoescape = context.autoescape
     context = context_class(result, autoescape=autoescape)
     return self.nodelist.render(context)