Add client search for sql

The patch add client search

Change-Id: I7c785a5e0d097b7084a6534ea6052298d751f0ad
This commit is contained in:
gecong1973 2018-11-28 19:36:22 -08:00
parent 8d7fe211fa
commit 7b55e1bc54
1 changed files with 7 additions and 1 deletions

View File

@ -372,7 +372,6 @@ def filter_tuple_by_search_opt(tuples, search=None):
def get_client(user_id, project_id=None, client_id=None, offset=0,
limit=100, search=None):
search = search or {}
clients = []
session = get_db_session()
with session.begin():
@ -401,6 +400,13 @@ def get_client(user_id, project_id=None, client_id=None, offset=0,
u'description': client.description}
clients.append(clientmap)
# If search opt is wrong, filter will not work,
# return all tuples.
try:
clients = filter_tuple_by_search_opt(clients, search)
except Exception as e:
LOG.error(e)
return clients