view.py
changeset 2795 59965167bef3
parent 2788 8d3dbe577d3a
child 2799 b703639614e7
--- a/view.py	Thu Aug 13 09:31:34 2009 +0200
+++ b/view.py	Thu Aug 13 09:41:05 2009 +0200
@@ -151,6 +151,19 @@
         if stream is not None:
             return self._stream.getvalue()
 
+    def tal_render(self, template, variables):
+        """render a precompiled page template with variables in the given
+        dictionary as context
+        """
+        from cubicweb.ext.tal import CubicWebContext
+        context = CubicWebContext()
+        context.update({'self': self, 'rset': self.rset, '_' : self.req._,
+                        'req': self.req, 'user': self.req.user})
+        context.update(variables)
+        output = UStringIO()
+        template.expand(context, output)
+        return output.getvalue()
+
     dispatch = deprecated('[3.4] .dispatch is deprecated, use .render')(render)
 
     # should default .call() method add a <div classs="section"> around each