diff 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
line wrap: on
line diff
--- a/roundup/scripts/roundup_server.py	Fri Nov 21 21:41:19 2003 +0000
+++ b/roundup/scripts/roundup_server.py	Thu Dec 04 02:39:04 2003 +0000
@@ -16,7 +16,7 @@
 # 
 """ HTTP Server that serves roundup.
 
-$Id: roundup_server.py,v 1.26.2.2 2003-11-11 22:25:00 richard Exp $
+$Id: roundup_server.py,v 1.26.2.3 2003-12-04 02:39:04 richard Exp $
 """
 
 # python version check
@@ -78,26 +78,28 @@
             self.send_error(404, self.path)
         except client.Unauthorised:
             self.send_error(403, self.path)
-        except socket.timeout:
-            s = StringIO.StringIO()
-            traceback.print_exc(None, s)
-            self.log_message(str(s.getvalue()))
         except:
-            # it'd be nice to be able to detect if these are going to have
-            # any effect...
-            self.send_response(400)
-            self.send_header('Content-Type', 'text/html')
-            self.end_headers()
-            try:
-                reload(cgitb)
-                self.wfile.write(cgitb.breaker())
-                self.wfile.write(cgitb.html())
-            except:
+            exc, val, tb = sys.exc_info()
+            if hasattr(socket, 'timeout') and exc == socket.timeout:
                 s = StringIO.StringIO()
                 traceback.print_exc(None, s)
-                self.wfile.write("<pre>")
-                self.wfile.write(cgi.escape(s.getvalue()))
-                self.wfile.write("</pre>\n")
+                self.log_message(str(s.getvalue()))
+            else:
+                # it'd be nice to be able to detect if these are going to have
+                # any effect...
+                self.send_response(400)
+                self.send_header('Content-Type', 'text/html')
+                self.end_headers()
+                try:
+                    reload(cgitb)
+                    self.wfile.write(cgitb.breaker())
+                    self.wfile.write(cgitb.html())
+                except:
+                    s = StringIO.StringIO()
+                    traceback.print_exc(None, s)
+                    self.wfile.write("<pre>")
+                    self.wfile.write(cgi.escape(s.getvalue()))
+                    self.wfile.write("</pre>\n")
         sys.stdin = save_stdin
 
     do_GET = do_POST = run_cgi

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