Web development with Python 3.1

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Wed Oct 28 07:33:03 EDT 2009


Dotan Cohen a écrit :
>>> I should probably expand on this:
>>>
>>> How can I get an array with all the GET variables in Python?
>>> How can I get an array with all the POST variables in Python?
>>> How can I get an array with all the COOKIE variables in Python?
>>> How can I get the request URI path (everything after
>>> http://[www.?]example.com/)?
>>>
>>> That's all I want: no templates and nothing between me and the HTML.
>>> The HTTP headers I can output to stdout myself as well.
>> Again: if you insist on doing everything yourself - then of course any
>> library or framework isn't for you.
>>
> 
> I insist on handling the HTML myself.

I just don't get how embedding HTML in applicative code - a well-known 
antipattern FWIW - relates to "handling the HTML yourself". Can you 
*please* explain how a templating system prevents you from "handling the 
HTML" yourself.

>> I think you underestimate the task it is to make a webapplication good.
> 
> Probably, but that would not depend on the scripting language. I make
> bad webapplications in PHP too!

Lol !

> 
>> And
>> even if not, what you will do is ... code your own webframework.
> 
> That is why I am looking for a class that handles the backend stuff,
> but lets _me_ handle the HTML.

For God's sake : *why on earth do you believe that using a templating 
system will make you loose _any_ control on the HTML code ???*


>> And at least pylons/TG2 lets you return whatever you want instead, as a
>> string. Not via "print" though - which is simply only for CGI, and no other
>> means (e.g. mod_wsgi) of python-web-programming.
>>
> 
> I am trying to follow you here. What is "return whatever you want"?
> Return HTML to stdout to be sent to the browser?

please leave stdout out of here - it's HTTP, so what we have are HTTP 
requests and HTTP responses - not stdin nor stdout. Using these streams 
as a mean of communication between the web server and the applicative 
code is just plain old low-level GCI stuff. Your application code 
shouldn't have any knowledge of this implementation detail - it should 
receive (a suitable representation of) an HTTP request, and generate (a 
suitable representation of) an HTTP response.



More information about the Python-list mailing list