diff --git a/halfapi/__init__.py b/halfapi/__init__.py index 10aa592..9274551 100644 --- a/halfapi/__init__.py +++ b/halfapi/__init__.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -__version__ = '0.5.1' +__version__ = '0.5.2' def version(): return f'HalfAPI version:{__version__}' diff --git a/halfapi/lib/domain.py b/halfapi/lib/domain.py index c310a9b..5ca13e0 100644 --- a/halfapi/lib/domain.py +++ b/halfapi/lib/domain.py @@ -6,7 +6,7 @@ lib/domain.py The domain-scoped utility functions import sys import importlib import logging -from types import ModuleType +from types import ModuleType, FunctionType from typing import Generator, Dict, List logger = logging.getLogger("uvicorn.asgi") @@ -188,6 +188,9 @@ def router_acls(route_params: Dict, path: List, m_router: ModuleType) -> Generat else: for param in params: acl = param.get('acl') + if not isinstance(acl, FunctionType): + continue + yield acl.__name__, acl diff --git a/halfapi/lib/routes.py b/halfapi/lib/routes.py index 0a50c7e..7faa342 100644 --- a/halfapi/lib/routes.py +++ b/halfapi/lib/routes.py @@ -169,6 +169,9 @@ def api_acls(request): for domain, m_domain in domains.items(): res[domain] = {} for acl_name, fct in domain_acls(m_domain, [domain]): + if not isinstance(fct, FunctionType): + continue + fct_result = fct.__doc__.strip() if doc and fct.__doc__ else fct(request) if acl_name in res[domain]: continue