Well that would require a serious restructuring of the application. I
went another direction
I've just looked in the Pylons sources and created a new function
solving the issue.
def render_mako_raw(template_name, extra_vars=None, cache_key=None,
cache_type=None, cache_expire=None):
"Render a javascript template with Mako, no caching"
def render_template():
globs = extra_vars or {}
globs.update(pylons.templating.pylons_globals())
template =
globs['app_globals'].mako_lookup.get_template(template_name)
return template.render_unicode(**globs)
return pylons.templating.cached_template(template_name,
render_template,
cache_key=cache_key, cache_type=cache_type,
cache_expire=cache_expire)
On 11 nov, 11:56, Piotr Kęplicz <[email protected]> wrote:
> cropr, czwartek 11 listopada 2010 11:36:
>
> > The output of the rendering is sent via a json call
>
> > @jsonify
> > def editProperties(self, **kwargs):
> > ...
> > jsfile = render(self.editPropertiesPath+'.js',
> > extra_vars=kwargs)
> > return dict(jsfile=jsfile, result='OK')
>
> I'd suggest not to mix these two approaches to rendering JSON responses.
> Either prepare the structure within the Python code with @jsonify, or process
> everything in the JS template with render().
>
> .pk.
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.