Rajout de l'argument "doc" sur la route /halfapi/acls

This commit is contained in:
Maxime Alves LIRMM@home 2021-04-22 11:45:12 +02:00
parent cd0df35496
commit e1c3d61207
1 changed files with 2 additions and 1 deletions

View File

@ -133,10 +133,11 @@ def api_routes(m_dom: ModuleType) -> Generator:
def api_acls(request): def api_acls(request):
res = {} res = {}
doc = 'doc' in request.query_params
for domain, d_domain_acl in request.scope['acl'].items(): for domain, d_domain_acl in request.scope['acl'].items():
res[domain] = {} res[domain] = {}
for acl_name, fct in d_domain_acl.items(): for acl_name, fct in d_domain_acl.items():
fct_result = fct(request) fct_result = fct.__doc__.strip() if doc and fct.__doc__ else fct(request)
if isinstance(fct_result, FunctionType): if isinstance(fct_result, FunctionType):
fct_result = fct()(request) fct_result = fct()(request)
res[domain][acl_name] = fct_result res[domain][acl_name] = fct_result