def get_special_handler(self, handler_func):
"""Wrap a special handler into a Tornado-compatible handler class."""
class SpecialHandler(tornado.web.RequestHandler):
"""Wrapper handler for special resources.
"""
def get(self):
status_code, reason, headers, content = handler_func()
self.set_status(status_code, reason)
for name, value in headers.items():
self.set_header(name, value)
self.write(content.encode('utf-8'))
return SpecialHandler
评论列表
文章目录