Michael
mogmios at mlug.missouri.edu
Sat Mar 6 15:49:40 EST 2004
I've been writing web apps since the beginning (since the time when I accessed the Internet over a 2400 baud modem and used a text based browser) and I agree with you. I never really saw the point of inline code in html. It's okay for short scripts but for applications it's a definate no-no IMO. With PHP I didn't use it and so far with Python I'm not using it. I like to collect my output in a variable and then write it to the client all at once. Python's string processing is quite nice in itself. A framework is definately the way to go and is why I'm moving from PHP to Python. PHP just doesn't lend itself well to that kind of use. The lack of decent namespace or objects makes any complex framework a pain to work with. Python, so far, looks much better. > As someone who spent a year writing in PHP, then switched to Python, I > missed the ability to 'execute' an HTML file with code embedded. > > I came across Spyce, and even wrote my own Python-in-HTML preprocessor. > > However, I'm since come to feel - and this is a personal thing - that > the very notion of embedding code within HTML is fraught with severe > suckage. > > I worked with the PHP-Nuke software, and even published a few add-ons > for it. > > For small jobs, (and jobs which stay small), embedding code into HTML > has its appeal. > > But as a web app grows into any level of sophistication, this whole > approach can give rise to some abominably messy code. > > So these days, I use a tag class library, and generate the HTML purely > from code. To me now, raw HTML feels like the 'assembly code', or even > the 'machine code', of web programming. I'm much preferring the > ability to build pages as a hierarchy of abstract widgets, where each > 'widget' is a class which ultimately renders down to HTML code. > > Lately, I've just finished the first cut of a web app framework called > pyweb.gui. As soon as I finish the documentation, I'll announce an > alpha to this and other lists. Early trials of pyweb.gui have seen me > able to build active web pages in a fraction of the time, and end up > with stateful web apps that can run identically over traditional CGI, > mod_python CGI, mod_python with custom handler or standalone server. > > pyweb.gui one one hand is 'just another' python web app framework. But > on the other hand, it is one of the few that can be deployed on even > the cheapest and most restrictive web hosts. > > So I ask people to question whether embedding code into HTML, > particularly with such a beautiful and powerfully-OO language like > Python, is really a desirable direction to go in.
|