2009/10/29 Albert Hopkins <mar...@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

http://what-is-what.com
http://gibberish.co.il
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to