From a42e6289c90531df6a45293411ae353cd1e251f6 Mon Sep 17 00:00:00 2001 From: SerenaFeng Date: Wed, 28 Jun 2017 11:22:59 +0800 Subject: bugfix: Exception when the results is empty list operation crash when limit is not provided, error message: OperationFailure: the limit must be positive JIRA: RELENG-265 Change-Id: Id8db93b594010d054a71d301d9c42eed113c12e1 Signed-off-by: SerenaFeng --- utils/test/testapi/opnfv_testapi/resources/handlers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'utils/test/testapi/opnfv_testapi/resources') diff --git a/utils/test/testapi/opnfv_testapi/resources/handlers.py b/utils/test/testapi/opnfv_testapi/resources/handlers.py index 0234c8a73..5c98c48ef 100644 --- a/utils/test/testapi/opnfv_testapi/resources/handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/handlers.py @@ -127,8 +127,8 @@ class GenericApiHandler(web.RequestHandler): total_pages += 1 pipelines.append({'$skip': (page - 1) * per_page}) pipelines.append({'$limit': per_page}) - else: - pipelines.append({'$limit': records_nr}) + elif last > 0: + pipelines.append({'$limit': last}) cursor = self._eval_db(self.table, 'aggregate', -- cgit 1.2.3-korg