Yesterday I finally got modpython working with the help of the friendly folks on the modpython mailing list. And then I started fooling around with a script I’m calling index.py. Eventually I’ll turn this into a template system for my new website (once I finally get off my butt and design myself one). But for now, I was just playing around, learning how to do stuff with this. So, to learn, I made myself a routine that duplicates the built-in FancyIndexing feature (you know, where you type in a directory that doesn’t have an index file and it displays a list of all the files, with icons and information). It duplicates everything except the Description column and sortable headers. Other than that, it looks identical to the real thing, even down to the spacing of elements and the icons (hell, I went to the trouble of parsing the server config for the AddIcon and AddIconByType and DefaultIcon directives just to get the icons right!). Later I’ll add the Description column and, hopefully, sortable headers. Then it will look exactly the same. The only way to tell the difference will be to look at the source, where you’ll see a much nicer-looking source than the built-in indexing feature.

The other facet of my script is anything accessed from inside that directory is funnelled through the script, i.e. the script is given the filename and it opens it and gets the content-type and outputs the contents of the file. The point of this, of course, is for the templating system, but for now it’s just for fun.

If you want to try it, just go here.

Please note that this address is only valid if my computer is plugged in at college. I’m going home Thursday, and at that point I’ll attempt to get a new URL for my computer
The URL is no longer valid
Leave a Reply

Preview: