You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
closure_contents= (c.cell_contentsforcincast(Any, fun).__closure__)
fun_closure=dict(zip(fun.__code__.co_freevars, closure_contents))
try:
class_kwargs=fun_closure['class_kwargs']
exceptKeyError:
# Most likely flask_restful resource, we'll see in a secondflask_restful_api=fun_closure['self']
# flask_restful wraps ResourceClass.as_view() result in its own wrapper# the as_view() result is available under 'resource' name in this closurefun=fun_closure['resource']
fun_closure= {}
class_kwargs= {}
# if the lines above succeeded we're quite sure it's flask_restful resource
The argument fun is the view function. If it's decorated, the value of fun.code.co_freevars will be scoped to the decorator, and it won't include fun_closure['self']
The text was updated successfully, but these errors were encountered:
The argument
fun
is the view function. If it's decorated, the value of fun.code.co_freevars will be scoped to the decorator, and it won't includefun_closure['self']
The text was updated successfully, but these errors were encountered: