Web development with Python 3.1

Dotan Cohen dotancohen at gmail.com
Fri Oct 30 16:55:21 EDT 2009


>> It is clear and obvious. But it has the "template engine" duplicating
>> a function that Python has built in. My goal is to learn reusable
>> Python (reusable for non-web projects). My goal is not to find the
>> quickest way to a website.
>
> Please correct me if I'm wrong, but you did learn HTML, CSS and SQL, didn't
> you ? How do any of these languages relates to Python ?-)
>

HTML and CSS yes, but just enough SQL to fake it. None of those
languages relate to Python, each language performs a different
function. However, the template language looks completely redundant as
it duplicates functionality of the language that I intend to learn.


>> won't help me learn Python any more than learning PHP would.
>> So going from PHP to Django is pointless.
>
> Please get out of the "server page" mindset. Templates are just that :
> templates. Period. You don't use templates to write your *applicative* code.
>

I understand that.


>> I meant reusable knowledge, not reusable code.
>
> There's very few "reusable knowledge" to be gained from templating code
> anyway- even if using a "python-based" template system like Mako. Unless you
> think doing a loop or a conditional are things you need to learn ?-)
>

I would say that one needs to know how to do a for loop in Python, in
order to program in Python!


>>> Then use Mako - it uses plain Python to manage the presentation logic.
>>
>> Now we're talking! I will look further into Pylons and Mako.
>
> Beware that the above comments about how less there's to learn from the
> templates code still apply - basically, the "programming" part of a template
> is restricted to simple branching, iterations, and variable substitution.
>

I see.


>> I don't expect to ever have a "team",
>
> Possibly not. But as strange as it migh be, there are other peoples that do,
> and most of these frameworks are written by professional web programmers.
>

I therefore counter that these frameworks were designed for people
unlike myself, which easily explains my resistance to them.


>> The point is that I want to use only _Python_ features, not
>> Django/Mako/whatever features.
>
> If so, you shouldn't use *any* third-part libs, and possibly not even the
> stdlib.
>

THat is going just a bit far!


> More seriously : reinventing the wheel - unless for educational purposes -
> is not really pythonic. If what you want is to learn, write your own
> framework, template system, form handling etc... You'll very certainly find
> out that they suck big time compared to existing projects, but you'll learn
> _at least_ one thing: that writing a sensible non-trivial framework or lib
> is *hard*.
>

Actually, I konw just how hard it is. PHP and some C in university.


>> However I am aware that some things I
>> should not touch for security reasons. That is why I want a framework:
>> to provide the security aspects of things like converting UTF-8,
>
> from what and to what ?-)
>

Into and out of the database.


> string / unicode encoding and decoding is a builtin Python feature.
>

I know, but I need to play with it a bit before I become comfortable
with how it is handled.


>> database escaping,
>
> Already provided by any DB-API compliant connector, at least if correctly
> used.
>
> Now there's *much* more in security (specially when doing web programming)
> than this...

Of course. But these are the relevant issues for Python.


-- 
Dotan Cohen

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



More information about the Python-list mailing list