view.py
changeset 2795 59965167bef3
parent 2788 8d3dbe577d3a
child 2799 b703639614e7
equal deleted inserted replaced
2794:54d18916374d 2795:59965167bef3
   149         view_func(**context)
   149         view_func(**context)
   150         # return stream content if we have created it
   150         # return stream content if we have created it
   151         if stream is not None:
   151         if stream is not None:
   152             return self._stream.getvalue()
   152             return self._stream.getvalue()
   153 
   153 
       
   154     def tal_render(self, template, variables):
       
   155         """render a precompiled page template with variables in the given
       
   156         dictionary as context
       
   157         """
       
   158         from cubicweb.ext.tal import CubicWebContext
       
   159         context = CubicWebContext()
       
   160         context.update({'self': self, 'rset': self.rset, '_' : self.req._,
       
   161                         'req': self.req, 'user': self.req.user})
       
   162         context.update(variables)
       
   163         output = UStringIO()
       
   164         template.expand(context, output)
       
   165         return output.getvalue()
       
   166 
   154     dispatch = deprecated('[3.4] .dispatch is deprecated, use .render')(render)
   167     dispatch = deprecated('[3.4] .dispatch is deprecated, use .render')(render)
   155 
   168 
   156     # should default .call() method add a <div classs="section"> around each
   169     # should default .call() method add a <div classs="section"> around each
   157     # rset item
   170     # rset item
   158     add_div_section = True
   171     add_div_section = True