template inheritance

James Matthews nytrokiss at gmail.com
Mon Jan 12 08:34:57 CET 2009

Not always sometimes you want to show some template code (You have a blog
about web dev) and sometimes you want to nest some code.

On Sun, Jan 11, 2009 at 10:04 PM, Diez B. Roggisch <deets at nospam.web.de>wrote:

> Alex K schrieb:
>> While building a website using template inheritance one usually does
>> the following:
>> fetch from database
>> fetch from some more data from database
>> ... << more required computations
>> then at the end render the template with the fetched data
>> Without template inheritance one usually does the following:
>> fetch from database
>> render this part of the site with this fetched data
>> fetch some more data from the database
>> render this other part of the site with the fetched data
>> ...
>> etc
>> The first approach is much more elegant and leads to easier to
>> maintain code. However the user will have to wait till the end of the
>> fetching (long computations) before any rendering can take place. In
>> the second approach however the site loads as we are fetching the data
>> which is more convenient to the user.
>> Am I correct to assume this? Is there a way to get the best of both
>> worlds? Thank you.
> I don't think that the question of inheritance or not is really relevant
> here.
> It's a matter of how the templating system is written - does it collect all
> the data beforehand, or not, is it potentially using e.g. generators and so
> forth.
> And of course how the programmer uses the templating system. does he fetch
> all the data beforehand, or does he use lazy generation approachs - again,
> e.g. generators, or callbacks.
> Besides, *usually* the 20-39Kb of a website itself aren't the problem I'd
> say - loading referenced resources is much more of an issue.
> And AFAIK the render-mode matters, too. If the site is XHTML-compliant, the
> browser can start the rendering once the HTML is complete - otherwise, it
> might wait until the referenced resources are all loaded to calculate the
> layout.
> Diez
> --
> http://mail.python.org/mailman/listinfo/python-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090112/57e71d10/attachment.html>

More information about the Python-list mailing list