[lib.domain] SUBROUTER can be a path parameter if including ":"

This commit is contained in:
Maxime Alves LIRMM 2021-06-15 09:45:37 +02:00
parent 138420461d
commit aa4c309778
1 changed files with 4 additions and 3 deletions

View File

@ -135,8 +135,6 @@ def gen_router_routes(m_router: ModuleType, path: List[str]) -> Generator:
routes[''][verb.upper()] = [{
'acl': acl.public
}]
else:
print(f'no {verb.lower()} in {m_router}')
routes['']['SUBROUTES'] = []
for item in os.listdir(list(m_router.__path__)[0]):
@ -153,6 +151,9 @@ def gen_router_routes(m_router: ModuleType, path: List[str]) -> Generator:
subroutes = route_params.get('SUBROUTES', [])
for subroute in subroutes:
logger.debug('Processing subroute **%s** - %s', subroute, m_router.__name__)
if ':' in subroute:
path.append(f'{{{subroute}}}')
else:
path.append(subroute)
try:
submod = importlib.import_module(f'.{subroute}', m_router.__name__)