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

Support __iter__ on Pagination instances. #70

Closed
rduplain opened this issue Feb 1, 2012 · 2 comments · Fixed by #1087
Closed

Support __iter__ on Pagination instances. #70

rduplain opened this issue Feb 1, 2012 · 2 comments · Fixed by #1087
Milestone

Comments

@rduplain
Copy link

rduplain commented Feb 1, 2012

I never remember to call .items, and I was just reminded of this when getting a new developer spun up. Instead of:

for obj in MyModel.query.paginate(1).items: pass

I expect:

for obj in MyModel.query.paginate(1): pass

... because SQLAlchemy's query API does this everywhere. This fails, because a Pagination instance is not iterable.

@rduplain
Copy link
Author

rduplain commented Feb 1, 2012

Current discussion on #pocoo irc: no harm in making it iterable, but at that point you might just use .offset().limit() on the SQLAlchemy query interface. If Pagination is used generally, outside of a SQL context, then an iterable interface would be more useful.

@rsyring rsyring added this to the 3.x milestone Mar 9, 2019
@davidism davidism modified the milestones: 3.x, 3.0 Sep 18, 2022
@davidism
Copy link
Member

fixed in #1087

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging a pull request may close this issue.

3 participants