flask-paginate icon indicating copy to clipboard operation
flask-paginate copied to clipboard

Crash when pagination set to 0 (aka disabled pagination)

Open mrjk opened this issue 4 years ago • 2 comments

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

mrjk avatar Oct 18 '20 23:10 mrjk

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

lixxu avatar Oct 19 '20 00:10 lixxu

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

lixxu avatar Jan 12 '21 08:01 lixxu