#!/usr/local/bin/python import cgi actionTable = { "home": "home.html", "features": "features.html", "screenshots": "screenshots.html", "demo": "demo.html", "download": "download.html", "purchase": "purchase.html", "license": "license.html", "about": "about.html" } htmlDir = "html" queryString = cgi.parse() def dumpFile(file): f = open(file, "r") print f.read() f.close() def printHeader(): dumpFile(htmlDir + "/header.html") def printFooter(): dumpFile(htmlDir + "/footer.html") def doAction(action): if action == "default": doAction("home") elif actionTable.has_key(action): print "Content-Type: text/html\n\n" printHeader() dumpFile(htmlDir + "/" + actionTable[action]) printFooter() else: print "Status: 404 Not Found" print "Content-Type: text/html\n\n" print "Sorry, I was not able to find the page you are looking for." if queryString.has_key("action"): action = queryString["action"][0] doAction(action) else: doAction("default")