Not sure about Mako, but the built-in templating engine lets you pipe
the output of one template rendering into another rendering call. Such
as (for v0.23):
some_calculation = 46 + 2
print render.base("RedBaron's Homepage",
render.layout(
render.sidebar1(some_calculation),
render.article("Why Python Rules", article_text)))
This pipes the sidebar1.html and article.html templates into
layout.html, which goes into base.html, and sends the resulting string
to the browser. (In web.py version 0.3 replace the print statement
with return.) There are no other restrictions on how you output a page
from web.py, so if Mako lets you do this (consult their documentation
or mailing list), it's possible in web.py too. Just construct the
string and print/return it.
Some data-crunching in your templates should be acceptable, if it's
for layout purposes. If it gets uncomfortable, you can always bring
the computation back into the calling method, construct some strings
there, and pass that into the template instead of the raw data.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---