diff options
author | 2011-11-13 23:40:52 +0100 | |
---|---|---|
committer | 2011-11-13 23:40:52 +0100 | |
commit | 62e2e976f1cdf1ca2f9b3019f210d85865eea514 (patch) | |
tree | a7ddb595131d68643ce784b499b2f10b32c24254 /github3/handlers/base.py | |
parent | Fix bug. Instance converter in handler base (diff) | |
download | python-github3-62e2e976f1cdf1ca2f9b3019f210d85865eea514.tar.xz python-github3-62e2e976f1cdf1ca2f9b3019f210d85865eea514.zip |
Fix limit bug
Diffstat (limited to 'github3/handlers/base.py')
-rw-r--r-- | github3/handlers/base.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/github3/handlers/base.py b/github3/handlers/base.py index 68eb6b4..c27b80c 100644 --- a/github3/handlers/base.py +++ b/github3/handlers/base.py @@ -48,19 +48,20 @@ class Handler(object): assert response.status_code == 204 return True - #TODO: if limit is multiple of per_page... it do another request for nothing def _get_resources(self, resource, model=None, limit=None, **kwargs): """ Hander request to multiple resources """ + if limit: + limit = abs(limit) resource = self._prefix_resource(resource) counter = 1 for page in Paginate(resource, self._gh.get, **kwargs): for raw_resource in page: - if limit and counter > limit: break counter += 1 converter = self._get_converter(**kwargs) converter.inject(model) yield converter.loads(raw_resource) + if limit and counter > limit: break else: continue break |