Web development with Python 3.1

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Thu Oct 29 09:46:32 EDT 2009


Dotan Cohen a écrit :
> 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.

Why so ???




More information about the Python-list mailing list