2024-10-02 08:27:27 发布
网友
我应该写一些这样的代码:
class SomePage(Resource): def render_GET(self, request): d = DoSomeQuery() # if d run success # return "success" # if d fails # return "fail"
我的意思是render_GET函数的返回值取决于延迟结果。在
我怎么能做到呢?在
添加以下内容:
d.addCallbacks(lambda _: "success", lambda _: "fail") d.addCallback(request.write) d.addBoth(lambda _: request.finish()) return server.NOT_DONE_YET
添加以下内容:
相关问题 更多 >
编程相关推荐