Web development with Python 3.1

Dotan Cohen dotancohen at gmail.com
Thu Oct 29 09:12:07 CET 2009

2009/10/29 Albert Hopkins <marduk at letterboxes.org>:
> On Wed, 2009-10-28 at 16:38 +0200, Dotan Cohen wrote:
>> > return HttpResponse(unmaintanable_html % data)
>> >
>> That's fine for single variables, but if I need to output a table of
>> unknown rows?  I assume that return means the end of the script.
>> Therefore I should shove the whole table into a variable and then copy
>> that variable to the array "data"?
> No, if you use a templating system like Django's then basically you pass
> a QuerySet to your template.  A QuerySet is basically a pointer to a SQL
> query, for example.  The templating system just knows to expect an
> iterable, it can be a list of rows or it can be a QuerySet which does a
> fetch from a database.  No need to shove an entire table into a
> variable.

Sounds like the system is trying to outsmart the programmer here.

> Another advantage if templates for many is that it allows programmers to
> do what they do best (write code) while letting web designers do what
> they do best (designing web pages) without them walking over each other
> (that much).

I do see that advantage.

Dotan Cohen


More information about the Python-list mailing list