Skip to content

Conversation

@idoshr
Copy link
Owner

@idoshr idoshr commented Jan 2, 2024

pagination:

  • Add option to start from page 0 instead of start only from 1
    compatibility:
  • Wft-form >= 3.1

@idoshr idoshr merged commit 14b116e into master Jan 5, 2024
idoshr pushed a commit that referenced this pull request Oct 31, 2025
Fixes Bug #4 and Bug #5 from BUG_REPORT.md

Changes:
- Add validation in all pagination classes to reject per_page <= 0
- Raises ValueError with clear message when per_page is invalid
- Prevents ZeroDivisionError crashes when per_page=0
- Prevents undefined behavior with negative per_page values

Modified files:
- flask_mongoengine/pagination/basic_pagination.py
- flask_mongoengine/pagination/keyset_pagination.py
- flask_mongoengine/pagination/list_field_pagination.py

Added comprehensive test coverage:
- tests/test_pagination.py: test_per_page_validation()
  - Tests per_page=0 for all pagination classes
  - Tests negative per_page for all pagination classes
  - Verifies correct ValueError is raised with proper message
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.

3 participants