Gascogne's recent timeline updates
Gascogne

Gascogne

V2EX member #493715, joined on 2020-06-07 22:26:17 +08:00
Gascogne's recent replies
fastapi 没 cbv,是因为挂 endpoint 到 route 节点时,要用 inspect 把函数参数都抓出来做 dependencies 树,才能做到类型检测和依赖项检测。加 cbv 的话,需要再写一套逻辑。自己造轮子的话,我之前试的一个方案,用 metaclass 把方法都抓出来,挨个送到 app 的装饰器里挂上。把之前装饰器的参数封成对象,放到类属性上。结果上来说,可以带 cls 参数,简单测试没发现问题。
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3668 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 22ms · UTC 10:38 · PVG 18:38 · LAX 03:38 · JFK 06:38
♥ Do have faith in what you're doing.