Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow reverse pagination #184

Merged
merged 4 commits into from
Aug 21, 2013

Conversation

davidbrai
Copy link
Contributor

Introduced a feature to PaginatedList to allow iteration in reversed order.
As a follow up do the discussion in #180

This uses the 'last' and 'prev' links in the HTTP headers.
The usage is repo.get_issues().reversed
@davidbrai
Copy link
Contributor Author

sorry for the broken build. fixing now.

Fixes a bug introduced in the previous commits.
Now testing a case where no lastUrl is returned.
Also fixing a regression where nextUrl wasn't erased properly.
Changed reversed(content) to content[::-1] in order to return
a real list and not a generator.
The code in PaginatedListBase.__grow does an iteration over
newElements when using `+=` and then returns them.
When using a generator, newElements would be empty when they are returned.
@bilderbuchi
Copy link

nice, that could be useful!
I lost the overview, will documentation of the feature be autogenerated, or should this be added to this PR?

@davidbrai
Copy link
Contributor Author

I didn't add any documentation.
Would love a pointer for how the autogenerated documentation works, or for someone to do another PR :)

@jacquev6
Copy link
Member

This sounds interesting, thank you! I'm back from holidays, I will analyze this PR in details soon.

@ghost ghost assigned jacquev6 Aug 15, 2013
jacquev6 added a commit that referenced this pull request Aug 21, 2013
This will avoid surprises if both the list and its reversed version
are iterated.
jacquev6 added a commit that referenced this pull request Aug 21, 2013
@jacquev6 jacquev6 merged commit cb03b9e into PyGithub:develop Aug 21, 2013
jacquev6 added a commit that referenced this pull request Aug 21, 2013
@davidbrai
Copy link
Contributor Author

cool 👍

@davidbrai davidbrai added the v1 label Mar 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants