Mercurial > p > roundup > code
comparison roundup/scripts/roundup_server.py @ 4344:85b00a3820b3
Fix thread safety with stdin in roundup-server
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 02 Feb 2010 05:00:42 +0000 |
| parents | 236939e4137b |
| children | 207499c0a3ed |
comparison
equal
deleted
inserted
replaced
| 4343:7a0fe3cff4de | 4344:85b00a3820b3 |
|---|---|
| 186 | 186 |
| 187 def run_cgi(self): | 187 def run_cgi(self): |
| 188 """ Execute the CGI command. Wrap an innner call in an error | 188 """ Execute the CGI command. Wrap an innner call in an error |
| 189 handler so all errors can be caught. | 189 handler so all errors can be caught. |
| 190 """ | 190 """ |
| 191 save_stdin = sys.stdin | |
| 192 sys.stdin = self.rfile | |
| 193 try: | 191 try: |
| 194 self.inner_run_cgi() | 192 self.inner_run_cgi() |
| 195 except client.NotFound: | 193 except client.NotFound: |
| 196 self.send_error(404, self.path) | 194 self.send_error(404, self.path) |
| 197 except client.Unauthorised, message: | 195 except client.Unauthorised, message: |
| 224 self.wfile.write('''<p>%s: An error occurred. Please check | 222 self.wfile.write('''<p>%s: An error occurred. Please check |
| 225 the server log for more infomation.</p>'''%ts) | 223 the server log for more infomation.</p>'''%ts) |
| 226 # out to the logfile | 224 # out to the logfile |
| 227 print 'EXCEPTION AT', ts | 225 print 'EXCEPTION AT', ts |
| 228 traceback.print_exc() | 226 traceback.print_exc() |
| 229 sys.stdin = save_stdin | |
| 230 | 227 |
| 231 do_GET = do_POST = do_HEAD = run_cgi | 228 do_GET = do_POST = do_HEAD = run_cgi |
| 232 | 229 |
| 233 def index(self): | 230 def index(self): |
| 234 ''' Print up an index of the available trackers | 231 ''' Print up an index of the available trackers |
