diff options
author | SerenaFeng <feng.xiaowei@zte.com.cn> | 2017-06-20 17:40:38 +0800 |
---|---|---|
committer | SerenaFeng <feng.xiaowei@zte.com.cn> | 2017-06-20 17:45:42 +0800 |
commit | b87da1f862c1966dba0c60cb5368b86bb698104e (patch) | |
tree | 5254e00c8185233327c688c6539b196ac5bd87f5 /testapi/opnfv_testapi/common/config.py | |
parent | c9cb0fd7d6b7f3736f94b0eebb517f248b8e670e (diff) |
support pagination in TestAPI
In this patch, pagination is supported, so you can go through results
leveraging: http://testresults.opnfv.org/test/api/v1/results?page=2
Change-Id: Ibe31c787643f27dbb06c4899e713b3c8e716e784
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'testapi/opnfv_testapi/common/config.py')
-rw-r--r-- | testapi/opnfv_testapi/common/config.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/testapi/opnfv_testapi/common/config.py b/testapi/opnfv_testapi/common/config.py index 46765ff..f73c0ab 100644 --- a/testapi/opnfv_testapi/common/config.py +++ b/testapi/opnfv_testapi/common/config.py @@ -17,6 +17,7 @@ class Config(object): def __init__(self): self.file = self.CONFIG if self.CONFIG else self._default_config() self._parse() + self._parse_per_page() self.static_path = os.path.join( os.path.dirname(os.path.normpath(__file__)), os.pardir, @@ -37,6 +38,10 @@ class Config(object): [setattr(self, '{}_{}'.format(section, k), self._parse_value(v)) for k, v in config.items(section)] + def _parse_per_page(self): + if not hasattr(self, 'api_results_per_page'): + self.api_results_per_page = 20 + @staticmethod def _parse_value(value): try: |