> This seems a really nasty hack though - any ideas for a cleaner way to
> do it?
You could overload handle_request instead. I think that makes more
sense anyway because you don't want to handle a SystemExit exception as
an error, you want to exit. Of course this only deals with catching the
exception, there may be a better method of shutting down and exiting
the server (other than sys.exit that is).
class HelpServer(HTTPServer):
def handle_request(self):
try:
request, client_address = self.get_request()
except socket.error:
return
if self.verify_request(request, client_address):
try:
self.process_request(request, client_address)
except SystemExit:
raise SystemExit
except:
self.handle_error(request, client_address)
self.close_request(request)
--
http://mail.python.org/mailman/listinfo/python-list