Web development with Python 3.1

Dotan Cohen dotancohen at gmail.com
Wed Oct 28 06:21:26 EDT 2009


2009/10/28 Bruno Desthuilliers <bruno.42.desthuilliers at websiteburo.invalid>:
> Dotan Cohen a écrit :
>>>
>>> declarative mapping of urls to code
>>
>> Apache does this, unless I am misunderstanding you.
>
> Using url rewriting ? Yes, fine. Then tell me how you implement "reverse"
> url generation (like Django or Routes do).

I have no idea what reverse url generation is. I assume that the user
will call http://example.com/path/to/script.py?var1=hello&var2=world

script.py would live in /home/user/site-name/public_html/path/to/



>>> of code to templates
>>
>> Those who code in HTML don't need this.
>
> ???
>

I would prefer to output everything from <html> to </html> with print
statements. I don't want some framework wrapping my output in tags, I
want the tags to be part of the output.


>> In any case it's not hard to
>> call a function in a class that writes the HTML before the content,
>> then write the content, then call another function that writes the
>> HTML after the content.
>
> Hmmm, yummy !  And SO maintainable...
>

Yes, why not?


>> This is how my sites are run, though in PHP
>> instead of Python. No prepackaged templates.
>
> PHP *is* a template language.
>

This is, in general what I'm doing:

<?php

// process GET POST and cookie variables, deal with mysql if needed

$title="blah";
include_once"/path/to/headerFile";

print "$content";

include_once"/path/to/footerFile";

exit();
?>


>> I would really like to know what else. So far, I am not convinced that
>> a framework offers anything that is not already easily accomplished in
>> Python.
>
> Given that we're talking about Python frameworks, it seems obvious that what
> they do can be accomplished in Python. Now the question is how much you like
> to write the same boring and error-prone boilerplate code project after
> project...
>

Like I said before, I don't want to have to maintain the functions
that turn the HTTP environment into Python variables, or the code that
manages database connections. Functions that escape data to be sent to
MySQL (to prevent sql injection) would be nice. Other than that, it's
all on me.

-- 
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il



More information about the Python-list mailing list