diff options
author | SerenaFeng <feng.xiaowei@zte.com.cn> | 2017-06-28 11:22:59 +0800 |
---|---|---|
committer | SerenaFeng <feng.xiaowei@zte.com.cn> | 2017-06-28 14:05:13 +0800 |
commit | ee40278f19c672fdb52f9c72a620d49744a190bd (patch) | |
tree | 4f4c254835963999b65090f91ef388f692623f5f /testapi/opnfv_testapi | |
parent | f97aba63106515a44ccda2bade003e9ee3503ec0 (diff) |
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 <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'testapi/opnfv_testapi')
-rw-r--r-- | testapi/opnfv_testapi/resources/handlers.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/testapi/opnfv_testapi/resources/handlers.py b/testapi/opnfv_testapi/resources/handlers.py index 0234c8a..5c98c48 100644 --- a/testapi/opnfv_testapi/resources/handlers.py +++ b/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', |