comparison roundup/scripts/roundup_server.py @ 1938:4cd5adcc1e87 maint-0.6

hard-coded python2.3-ism (socket.timeout) fixed
author Richard Jones <richard@users.sourceforge.net>
date Thu, 04 Dec 2003 02:39:04 +0000
parents e2727ced8bea
children 5add2b83cfa3
comparison
equal deleted inserted replaced
1934:19a266a49595 1938:4cd5adcc1e87
14 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, 14 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
15 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 15 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
16 # 16 #
17 """ HTTP Server that serves roundup. 17 """ HTTP Server that serves roundup.
18 18
19 $Id: roundup_server.py,v 1.26.2.2 2003-11-11 22:25:00 richard Exp $ 19 $Id: roundup_server.py,v 1.26.2.3 2003-12-04 02:39:04 richard Exp $
20 """ 20 """
21 21
22 # python version check 22 # python version check
23 from roundup import version_check 23 from roundup import version_check
24 24
76 self.inner_run_cgi() 76 self.inner_run_cgi()
77 except client.NotFound: 77 except client.NotFound:
78 self.send_error(404, self.path) 78 self.send_error(404, self.path)
79 except client.Unauthorised: 79 except client.Unauthorised:
80 self.send_error(403, self.path) 80 self.send_error(403, self.path)
81 except socket.timeout:
82 s = StringIO.StringIO()
83 traceback.print_exc(None, s)
84 self.log_message(str(s.getvalue()))
85 except: 81 except:
86 # it'd be nice to be able to detect if these are going to have 82 exc, val, tb = sys.exc_info()
87 # any effect... 83 if hasattr(socket, 'timeout') and exc == socket.timeout:
88 self.send_response(400)
89 self.send_header('Content-Type', 'text/html')
90 self.end_headers()
91 try:
92 reload(cgitb)
93 self.wfile.write(cgitb.breaker())
94 self.wfile.write(cgitb.html())
95 except:
96 s = StringIO.StringIO() 84 s = StringIO.StringIO()
97 traceback.print_exc(None, s) 85 traceback.print_exc(None, s)
98 self.wfile.write("<pre>") 86 self.log_message(str(s.getvalue()))
99 self.wfile.write(cgi.escape(s.getvalue())) 87 else:
100 self.wfile.write("</pre>\n") 88 # it'd be nice to be able to detect if these are going to have
89 # any effect...
90 self.send_response(400)
91 self.send_header('Content-Type', 'text/html')
92 self.end_headers()
93 try:
94 reload(cgitb)
95 self.wfile.write(cgitb.breaker())
96 self.wfile.write(cgitb.html())
97 except:
98 s = StringIO.StringIO()
99 traceback.print_exc(None, s)
100 self.wfile.write("<pre>")
101 self.wfile.write(cgi.escape(s.getvalue()))
102 self.wfile.write("</pre>\n")
101 sys.stdin = save_stdin 103 sys.stdin = save_stdin
102 104
103 do_GET = do_POST = run_cgi 105 do_GET = do_POST = run_cgi
104 106
105 def index(self): 107 def index(self):

Roundup Issue Tracker: http://roundup-tracker.org/