[lib.domain] wraps function when loading routes from modules, to get the real name

This commit is contained in:
Maxime Alves LIRMM 2021-11-22 20:09:57 +01:00
parent 4a8cb008e6
commit f4880f1f9c

View File

@ -8,6 +8,7 @@ import re
import sys import sys
import importlib import importlib
import inspect import inspect
from functools import wraps
from types import ModuleType, FunctionType from types import ModuleType, FunctionType
from typing import Coroutine, Generator from typing import Coroutine, Generator
from typing import Dict, List, Tuple, Iterator from typing import Dict, List, Tuple, Iterator
@ -45,6 +46,7 @@ def route_decorator(fct: FunctionType, ret_type: str = 'json') -> Coroutine:
""" Returns an async function that can be mounted on a router """ Returns an async function that can be mounted on a router
""" """
if ret_type == 'json': if ret_type == 'json':
@wraps(fct)
@acl.args_check @acl.args_check
async def wrapped(request, *args, **kwargs): async def wrapped(request, *args, **kwargs):
fct_args_spec = inspect.getfullargspec(fct).args fct_args_spec = inspect.getfullargspec(fct).args