Web development with Python 3.1

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Wed Oct 28 12:17:52 CET 2009

Dotan Cohen a écrit :
>>> While I know that to be true in the general sense, from what I've
>>> looked at Django and other frameworks it seems that the web frameworks
>>> push the coder to use templates, not letting him near the HTML.
>> Well... there must be a reason, for sure... No ?
> ֹYes, but I don't like it.

Why so ? What's your problem with templating systems, exactly ?

>>> Django and the other frameworks seem to
>>> force the user to use templates.
>> Not at all. Nothing prevents you from shooting yourself in the foot and
>> generating HTML "by hand" in your view functions (or request handler methods
>> etc, depending on the framework).
> How is this done in Django, then?

def index(request):
     unmaintanable_html = """
     <h1>Embedded HTML is a PITA</h1>
     <p>but some like pains...</p>
     return HttpResponse(unmaintanable_html)

>> This is just plain stupid wrt/
>>  readability, maintainability, reuse and whatnot, but hey, if you want to
>> waste your time, please do. As far as i'm concerned, I'm very happy to let
>> the HTML coder write the HTML part and the application programmer write the
>> applicative part - even when I end up wearing both caps.
> I've done stupider things.

Your choice, once again...

More information about the Python-list mailing list