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

Crash when pagination set to 0 (aka disabled pagination) #87

Open
mrjk opened this issue Oct 18, 2020 · 2 comments
Open

Crash when pagination set to 0 (aka disabled pagination) #87

mrjk opened this issue Oct 18, 2020 · 2 comments

Comments

@mrjk
Copy link

mrjk commented Oct 18, 2020

Hi,

If I set the pp=0 when creating a new Pagination instance, I've this error:

    p = Pagination(
  File "/home/xxx/prj/xxx/xxx/venv/lib/python3.8/site-packages/flask_paginate/__init__.py", line 403, in __init__
    self.init_values()
  File "/home/xxx/prj/xxx/xxx/venv/lib/python3.8/site-packages/flask_paginate/__init__.py", line 423, in init_values
    pages = divmod(current_total, self.per_page)
ZeroDivisionError: integer division or modulo by zero

Well, it seems data validation should be done inside the module (especially in a web context for obvious security reasons). Second point, when set to 0, it would be nice to completely disable the pagination (New feature).

I'd be glad to do/help with the patch :)

Cheers

@lixxu
Copy link
Owner

lixxu commented Oct 19, 2020

I don't understand what's the meaning of it. If you want to disable it, why you use the pagination.

@lixxu
Copy link
Owner

lixxu commented Jan 12, 2021

new version 0.8.0 can fix this issue, please try it.

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

No branches or pull requests

2 participants