I do a lot of generating web pages using Python. Python because I think Python 2.7 is awesome, and web pages because I do lots of work with various web sites that require dynamic results. Python is a very useful tool for me to get those dynamic results. It’s server-side (at least, the way I use it, it is, because I really try not to embed client-side resource usurping things), it is fast and efficient, and it is what I am comfortable with.

The thing is, web pages — generally speaking — aren’t all that simple if you really do them right. You can’t just throw a few tags together, test them on one browser, and hope you’re golden. Because you won’t be, I can pretty much promise you.

So, time for automation. An import library where the objective is to generate wholly correct HTML pages, leaving us with nothing but the body of the page, text or HTML, to be concerned with. I offer this import library in the hopes someone else with the same kind of task load I have will find it useful.

aa_webpage.py knows about HTML 3.2, 4.01 strict, 4.01 loose/transitional, and 4.01 frameset web pages, as well as pure text web pages.

aa_webpage.py takes care of the leading text-mode information for the web browser, the DTD, the page language, script and style placement, provides handy page validation testing links and the appropriate test-linked "bragging" icons for when you get it right, body tags (or not, if you’re using frames), character set specification, informative error and warning messages as you develop your web pages, and most of all, surprisingly enough, almost complete simplification of the task at hand — leaving you to develop the content, with worries about the complex nuts and bolts of the wrapping HTML page forgotten.

Click to download aa_webpage.py.gz — import library

Click to download test_webpage.py.gz — demonstration utilizing aa_webpage.py


Revision Changes
1.0.0 Initial Release.