I used to write my controllers this way (speudo code):
class hello:
def GET(self):
a = get_data_base()
yield template1(a)
b = get_data_base2()
yield template2(b)
Now using template inheritance I write them this way:
class hello:
def GET(self):
a = get_data_base()
b = get_data_base2()
return template2(template1(a), b)
The second approach leads to a cleaner and easier to maintain code.
The templates are easier to write and to read. However I have to wait
until a and b finish before rendering anything. In the first approach
I can render data as it comes.
Is there any way to get the best of both worlds? I read about
web.background but i'd think it's inelegant to use it for every get ..
functions. At first I thought that this is what yield would do. Thank
you.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---