Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add MAX_PAGE_SIZE setting#9107

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
TheSuperiorStanislav wants to merge5 commits intoencode:master
base:master
Choose a base branch
Loading
fromTheSuperiorStanislav:add-max-page-setting-for-pagination

Conversation

TheSuperiorStanislav
Copy link
Contributor

@TheSuperiorStanislavTheSuperiorStanislav commentedSep 14, 2023
edited
Loading

Description

Add a setting for max page size for global pagination. Our team discovered that by default, page size is unlimited which could lead to API abuse and the only way to fix it -> it's to subclass pagination class(which is a working solution, but not convenient). After investigating issues I found relatedissue andcomment.

sevdog reacted with thumbs up emoji
@auvipyauvipy self-requested a reviewSeptember 14, 2023 14:11
Copy link
Member

@auvipyauvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think this deserve a test case,, but as it is adding/exposing new API surface to the framework, we might need to pass the design decision step first

@auvipy
Copy link
Member

auvipy commentedSep 14, 2023
edited
Loading

OK I saw the comment now#6185 (comment) it might be possible in class level but not globally at the moment.

@auvipyauvipy added this to the3.15 milestoneSep 14, 2023
@TheSuperiorStanislav
Copy link
ContributorAuthor

@auvipy I added tests for system checks, but didn't managed to find and add tests for settings with API requests like intest_pagination.py, and it's kind hard to add since pagination settings are defined as class attrs.

auvipy reacted with thumbs up emoji

@auvipy
Copy link
Member

we got a PR related to this area#8993. would be helpful if you review and share your views on the PR.

@ankitchhatbar
Copy link

ankitchhatbar commentedDec 22, 2023
edited
Loading

@auvipy@christophehenry@TheSuperiorStanislav If you don't mind, I can take this up and implement the changes requested

@TheSuperiorStanislav
Copy link
ContributorAuthor

TheSuperiorStanislav commentedAug 21, 2024
edited
Loading

@auvipy@christophehenry Could you please take a look? Sorry for taking that long, btw 🥲

Comment on lines +191 to +196
def page_size(self) -> int:
"""Get default page size.

Defaults to `None`, meaning pagination is disabled.

"""

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

There shoud probably be a comment explaining why this i a property to avoid removing it in a future refactor?

@christophehenry
Copy link

christophehenry commentedAug 21, 2024
edited
Loading

Looks good to me. Thank you.

@TheSuperiorStanislav
Copy link
ContributorAuthor

@auvipy Could you take a look, please? This pr has been here for a while)

ulgens reacted with heart emoji

limit_query_param = 'limit'
limit_query_description = _('Number of results to return per page.')
offset_query_param = 'offset'
offset_query_description = _('The initial index from which to return the results.')
max_limit = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can we avoid changing the style here?

max_limit=api_settings.MAX_PAGE_SIZE

Perfer minimal impact footprints for PRs.

Copy link
ContributorAuthor

@TheSuperiorStanislavTheSuperiorStanislavSep 20, 2024
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It's related to#8993 and#9107 (comment). Without it we can't properly test it, since this setting will be set during init.

Copy link
Member

@tomchristietomchristieSep 20, 2024
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Hrm... not sure? If you'd like to take that approach then I'd probably suggest handling#8993 separately, as a precursor to this.
Unclear to me why that'd be different to attributeswe use in other cases.

browniebroke reacted with thumbs up emoji
@staleStale
Copy link

stalebot commentedApr 26, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stalestalebot added the stale labelApr 26, 2025
@browniebrokebrowniebroke removed this from the3.15 milestoneJul 6, 2025
@stalestalebot removed the stale labelJul 6, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@christophehenrychristophehenrychristophehenry approved these changes

@auvipyauvipyAwaiting requested review from auvipy

@tomchristietomchristieAwaiting requested review from tomchristie

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

6 participants
@TheSuperiorStanislav@auvipy@ankitchhatbar@christophehenry@tomchristie@browniebroke

[8]ページ先頭

©2009-2025 Movatter.jp