Closed Jaymon closed 6 months ago
So I just ran into a subtle bug (not so subtle after I finally figured it out), I basically had a setup like this:
class Foo(Controller):
@child_of_param("child_variable_name")
@param("variable_name")
def POST(self, **kwargs): pass
So when endpoints actually handles the decorators, it's the @param
call that runs all the decorators and @child_of_param
uses an async param_class.handle
method. That caused the handling to fail because the internal param was never awaited. That's because @param
just called param.handle
in param.handle_param
.
There are a few fixes for this, one of them is to modify param.handle_param
to check if the passed in param
has an async handle method and await it if it does. I can also have the param keep track of the actual decorators and call their methods instead of its own.
In the end, I think both of these should be done, so decorators.call.param
should be modified to:
param.param_class
instancesparam
argument.
I've extended
call.Param
in another project and I made my new class have an asynchandle
method, but that meant I needed to overridedecorators.call.param.handle_param
to useawait
. IfParam.handle
was already async then I wouldn't have had to change theparam
decorator at all except to setparam_class