# HG changeset patch # User Sylvain Thénault # Date 1250155492 -7200 # Node ID 0313eecc707ebb66e99a82be6991b6aaec383c69 # Parent 85f7502d32bef5ee9d5d3dec4899c81d8cbe42ff entity has no more tal_render method diff -r 85f7502d32be -r 0313eecc707e common/mttransforms.py --- a/common/mttransforms.py Thu Aug 13 11:24:14 2009 +0200 +++ b/common/mttransforms.py Thu Aug 13 11:24:52 2009 +0200 @@ -15,6 +15,7 @@ register_pil_transforms, register_pygments_transforms) +from cubicweb.utils import UStringIO from cubicweb.common.uilib import rest_publish, html_publish HTML_MIMETYPES = ('text/html', 'text/xhtml', 'application/xhtml+xml') @@ -43,7 +44,7 @@ ENGINE.add_transform(html_to_html()) try: - from cubicweb.ext.tal import compile_template + from cubicweb.ext.tal import CubicWebContext, compile_template except ImportError: HAS_TAL = False from cubicweb import schema @@ -57,8 +58,16 @@ output = 'text/html' output_encoding = 'utf-8' def _convert(self, trdata): - value = trdata.encode(self.output_encoding) - return trdata.appobject.tal_render(compile_template(value), {}) + context = CubicWebContext() + appobject = trdata.appobject + context.update({'self': appobject, 'rset': appobject.rset, + 'req': appobject.req, + '_' : appobject.req._, + 'user': appobject.req.user}) + output = UStringIO() + template = compile_template(trdata.encode(self.output_encoding)) + template.expand(context, output) + return output.getvalue() ENGINE.add_transform(ept_to_html())