]> git.ipfire.org Git - ipfire.org.git/blob - www/web/http.py
Fixed css of IE6 fixes.
[ipfire.org.git] / www / web / http.py
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4 code2msg = { 200 : "OK",
5 302 : "Temporarily Moved",
6 404 : "Not found",
7 500 : "Internal Server Error", }
8
9 class HTTPResponse:
10 def __init__(self, code, header=None, type="text/html"):
11 self.code = code
12
13 print "Status: %s - %s" % (self.code, code2msg[self.code],)
14 if self.code == 302:
15 print "Pragma: no-cache"
16 if type:
17 print "Content-type: " + type
18 if header:
19 for (key, value,) in header:
20 print "%s: %s" % (key, value,)
21 print
22
23 def execute(self, content=""):
24 if self.code == 200:
25 print content
26
27 class WebError(Exception):
28 pass