From e1c3d6120726b55a47afcc45d5b2f5aebf48ffcb Mon Sep 17 00:00:00 2001 From: "Maxime Alves LIRMM@home" Date: Thu, 22 Apr 2021 11:45:12 +0200 Subject: [PATCH] Rajout de l'argument "doc" sur la route /halfapi/acls --- halfapi/lib/routes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/halfapi/lib/routes.py b/halfapi/lib/routes.py index 6cfcb09..c9da4b8 100644 --- a/halfapi/lib/routes.py +++ b/halfapi/lib/routes.py @@ -133,10 +133,11 @@ def api_routes(m_dom: ModuleType) -> Generator: def api_acls(request): res = {} + doc = 'doc' in request.query_params for domain, d_domain_acl in request.scope['acl'].items(): res[domain] = {} 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): fct_result = fct()(request) res[domain][acl_name] = fct_result