So far, to render a response object in 0.9 we have:
response('some string')
render_response('/some/template')
render_response_fragment('/some/template')
The latter two merely calling response(render('/some/template')). I'd
like to unify these before 0.9 as Rails did, because it just seems to
make sense to have the most common method the default, and a single
rendering command. If anyone has suggestions for how this unification
would work in practice, I'm looking for ideas right now.
Of course, Rails has it slightly easier since the *only* way to pass
variables into templates is via the instance variables. It'd be a lot
simpler to unify our render commands if the method of getting
variables into the templates was restricted to utilizing the 'c'
object. So that's an approach I'm highly considering, and if you
really want to render templates and pass the variables in, you could
continue to use the buffet object directly to render templates.
So given all that, this is the new render command function def I'm
thinking of:
def render(*args, response=True, fragment=False)
Setting response=False would result in the response coming back as a
string.
So here's some equivalent statements:
render('/some/template') == render('/some/template', response=False)
render_response('/some/template') == render('/some/template')
response('some string') == render('str', 'some string')
I'm not particularly happy with this arrangement though, and using a
template engine called 'str' to render a string is pretty hackish.
Of course, alternatively, maybe there's no reason to unify the render
commands, and the current setup is just fine. :)
Thoughts?
Cheers,
Ben
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---