diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2017-08-04 11:10:48 +0200 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2017-08-04 12:07:30 +0200 |
commit | 5a4aafb6ec7a3927551f2ce79425c60c399addd5 (patch) | |
tree | 62c17f40f4f212d210dcb78968d292f72b7828f7 /gitlab/mixins.py | |
parent | d7c79113a4dd4f23789ac8adb17add590929ae53 (diff) | |
download | gitlab-5a4aafb6ec7a3927551f2ce79425c60c399addd5.tar.gz |
Restore the prvious listing behavior
Return lists by default : this makes the explicit use of pagination work
again.
Use generators only when `as_list` is explicitly set to `False`.
Diffstat (limited to 'gitlab/mixins.py')
-rw-r--r-- | gitlab/mixins.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gitlab/mixins.py b/gitlab/mixins.py index 5876d58..4fc21fb 100644 --- a/gitlab/mixins.py +++ b/gitlab/mixins.py @@ -71,15 +71,15 @@ class ListMixin(object): """Retrieve a list of objects. Args: - **kwargs: Extra options to send to the Gitlab server (e.g. sudo). - If ``all`` is passed and set to True, the entire list of - objects will be returned. + all (bool): If True, return all the items, without pagination + per_page (int): Number of items to retrieve per request + page (int): ID of the page to return (starts with page 1) + as_list (bool): If set to False and no pagination option is + defined, return a generator instead of a list + **kwargs: Extra options to send to the Gitlab server (e.g. sudo) Returns: - RESTObjectList: Generator going through the list of objects, making - queries to the server when required. - If ``all=True`` is passed as argument, returns - list(RESTObjectList). + list: The list of objects, or a generator if `as_list` is False Raises: GitlabAuthenticationError: If authentication is not correct |