First beginnings of a CGI output
[darcs-mirror-sem_syn.git] / testcgi.py
1 #!/usr/bin/python
2
3 from BaseHTTPServer import HTTPServer
4 from CGIHTTPServer import CGIHTTPRequestHandler
5 import sys
6
7 class MyRequestHandler(CGIHTTPRequestHandler):
8         def is_cgi(self):
9                 self.cgi_info = ("","")
10                 return True
11
12         def translate_path(self, path):
13                 return sys.argv[1]
14
15
16 if len(sys.argv) == 1:
17     print "Usage: %s cgi-script" % sys.argv[0]
18 else:    
19     server_address = ('', 8000)
20     http  = HTTPServer(server_address, MyRequestHandler)
21     print "Please connect to http://localhost:%d/" % server_address[1]
22     http.serve_forever()