Code clean up. Working on returning proper 404 vs 400 responses if the results are empty and nothing went wrong.
This commit is contained in:
@@ -567,7 +567,7 @@ def load_account_obj(
|
||||
|
||||
|
||||
# ### BEGIN ### API Account Methods ### get_account_rec_list() ###
|
||||
# Updated 2021-09-28
|
||||
# Updated 2021-12-13
|
||||
def get_account_rec_list(
|
||||
limit: int = 25,
|
||||
enabled: str = 'enabled', # enabled, disabled, all
|
||||
@@ -604,12 +604,15 @@ def get_account_rec_list(
|
||||
ORDER BY `account`.created_on DESC, `account`.updated_on DESC
|
||||
{sql_limit};
|
||||
"""
|
||||
log.debug(sql)
|
||||
|
||||
if account_rec_li_result := sql_select(data=data, sql=sql, as_list=True):
|
||||
log.info('Got a list result')
|
||||
account_rec_li = account_rec_li_result
|
||||
else:
|
||||
account_rec_li = []
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
else: # [] or False
|
||||
log.info('No results or something went wrong')
|
||||
account_rec_li = account_rec_li_result
|
||||
|
||||
log.debug(account_rec_li_result)
|
||||
|
||||
return account_rec_li
|
||||
|
||||
Reference in New Issue
Block a user