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   ·   5446 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 13ms · UTC 09:06 · PVG 17:06 · LAX 02:06 · JFK 05:06
♥ Do have faith in what you're doing.