[half_domain] fix ACL route when checked ACL is a decorator

This commit is contained in:
Maxime Alves LIRMM 2023-09-01 04:58:12 +09:00
parent 1cc1bbd5ef
commit 673097adeb
1 changed files with 14 additions and 0 deletions

View File

@ -189,6 +189,20 @@ class HalfDomain(Starlette):
} }
if elt.public: if elt.public:
try:
if inspect.iscoroutinefunction(fct):
logger.warning('async decorator are not yet supported')
else:
inner = fct()
if inspect.iscoroutinefunction(fct) or callable(inner):
fct = inner
except TypeError:
# Fct is not a decorator or is not well called (has no default arguments)
# We can ignore this
pass
routes.append( routes.append(
AclRoute(f'/{elt.name}', fct, elt) AclRoute(f'/{elt.name}', fct, elt)
) )