Skip to content

Conversation

ukleinek
Copy link
Contributor

While working on integrating patchwork in my mail setup I noticed that pwclient list only lists up to 30 patches. So the motivation for this patch series is commit 7477b4d. The other changes are preparing this or simple cleanups noticed on the way.

ukleinek added 2 commits May 22, 2025 17:55
As a desired side effect this allows to let api.patch_list() return a
generator instead of a list.
ukleinek added 3 commits May 22, 2025 18:49
If there are many patches (or other objects) to be listed, patchwork
only returns the first 30 by default. In such a case continue fetching
objects using the "next" link provided in the Link: header.

Note this changes REST._list() to return a generator instead of a list.
All callers only use it to generate a list, so this isn't a problem.
Similar to commit 70f96f9 ("support the delegate filter for REST
API") which added the delegate filter this implements an exact match
only and not (as promised by `pwclient list -h`) as substring match.

But for the same reason as for the delegate filter this is better than
ignoring a passed submitter.
This has the advantage that with pagination the first entries are already
provided before later entries are queried from the server. Also if the
generator isn't walked through completely, only the needed queries are
actually executed.

All callers of these functions can cope with the returned object being a
generator now instead of a list as they just iterate once over it.
@jacob-keller
Copy link
Contributor

I like your cleanups and would prefer we take this over my PR. I do think that if we are going to depend on requests it may make sense to use it for more than just the one function... But that could always be a future cleanup.

@robherring
Copy link
Contributor

@stephenfin Any chance this can get merged? pwclient is pretty useless with the REST backend without this IMO, and some instances don't enable xmlrpc any more.

@stephenfin
Copy link
Member

I have taken all of the fixups from this series, but gone with the pagination implementation from #26 (with a follow-up commit to use a generator). Please let me know if I've missed anything.

@stephenfin stephenfin closed this Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants