flask-paginate
flask-paginate copied to clipboard
Crash when pagination set to 0 (aka disabled pagination)
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
I don't understand what's the meaning of it. If you want to disable it, why you use the pagination.
new version 0.8.0
can fix this issue, please try it.