Return empty lists when no identifier found

This commit is contained in:
Carmeli Tamir 2020-03-07 03:38:19 -05:00
parent e9d970ced1
commit 0a96ceef9d

View file

@ -27,16 +27,12 @@ class IdentResource:
version = query('latest')
symbol_definitions, symbol_references = query('ident', version, ident)
if len(symbol_definitions) or len(symbol_references):
resp.body = json.dumps(
{
'definitions': [sym.__dict__ for sym in symbol_definitions],
'references': [sym.__dict__ for sym in symbol_references]
})
resp.status = falcon.HTTP_200
else:
raise falcon.HTTPNotFound({'title': 'Requested identifier not found in {} project'.format(project)})
resp.body = json.dumps(
{
'definitions': [sym.__dict__ for sym in symbol_definitions],
'references': [sym.__dict__ for sym in symbol_references]
})
resp.status = falcon.HTTP_200
application = falcon.API()