Dotan Cohen a écrit :
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.
Why so ???
--
http://mail.python.org/mailman/listinfo/python-list