#!/usr/bin/python2.3 import cgi import cgitb; cgitb.enable() import os import sys debug = 0 if debug: for key in os.environ.keys(): value = os.environ.get(key) print key, value PATH_INFO = os.environ.get('PATH_INFO', '') if PATH_INFO == '/robots.txt': print "Content-Type: text/plain\n\nUser-agent: *\nDisallow: /\n" # And stop sys.exit(0) else: print "Content-Type: application/xhtml+xml" print from htmltmpl import TemplateManager, TemplateProcessor template = TemplateManager().prepare("basic.tmpl") tproc = TemplateProcessor() # By default cgi.escape tproc.set("code", open(__file__).read()) tproc.set("template", open("basic.tmpl").read()) tproc.set("apache", open("/etc/apache/conf/robots.dabase.com.conf").read()) print tproc.process(template)