web.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:sadm 作者: prologin 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号