Skip to content

Commit

Permalink
Disable pagination when page-size is 0 or -1
Browse files Browse the repository at this point in the history
When --page-size <-1, raise error info.

JIRA: PDC-1636
  • Loading branch information
bliuredhat committed Aug 2, 2016
1 parent 92eb50c commit b6de9b7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pdc_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,15 @@ def get_paged(self, res, **kwargs):
for release in client.get_paged(client['releases']._, active=True):
...
"""
if self.page_size:
if self.page_size >= -1:
kwargs['page_size'] = self.page_size
else:
print("'%s' is a invalid number, please verify it again." % self.page_size)
sys.exit(1)

if self.page_size in [0, -1]:
# When page-size is 0 or -1, which disable pagination.
return res(**kwargs)

def worker():
kwargs['page'] = 1
Expand Down

0 comments on commit b6de9b7

Please sign in to comment.