Commit 91b63f0e authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

move tal_render to View

parent 54d18916374d
......@@ -386,21 +386,6 @@ class AppObject(object):
method = self.req.relative_path(includeparams=False) or 'view'
return self.req.build_url(method, **kwargs)
# formating methods #######################################################
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()
# deprecated ###############################################################
@classproperty
......
......@@ -151,6 +151,19 @@ class View(AppObject):
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment