def handle(self):
env = self.prepare_env()
try:
try:
result = self.server.application(env, self.start_response)
try:
self.data.extend(result)
finally:
if hasattr(result, 'close'):
result.close()
except GreenletExit:
self._reply500()
raise
except:
traceback.print_exc()
try:
sys.stderr.write('%s: Failed to handle request:\n request = %s\n application = %s\n\n' %
(self.server, self.request, self.server.application))
except Exception:
pass
self._reply500()
finally:
sys.exc_clear()
if self is not None and self.code is not None:
self.end(env)
评论列表
文章目录