Ticket #1629 (closed defect: fixed)

Opened 5 months ago

Last modified 5 months ago

Give tg_paginate_limit=0 a useful meaning

Reported by: toshio Assigned to: anonymous
Priority: normal Milestone: 1.0.4
Component: TurboGears Version: 1.0.3.2
Severity: normal Keywords:
Cc: lmacken@redhat.com

Description

Currently, a paginated controller url allows the end user to specify tg_paginate_limit=0. Doing so, however, results in a zeroDivisionError traceback because the paginate decorator doesn't know how to construct a page with zero records on the page. This has been a problem for one of our sites where search robots have been hitting pages with tg_paginate_limit=0 set[*]_.

Separately, I've been looking for a way that end users can tell paginate that they want to view all of the results on one page if they don't know how many results are present in the first place. Since positive numbers and negative numbers both have a meaning to paginate, zero seems like a reasonable choice for this functionality (and has precedent in other tools where zero means turn off this feature.)

I'll attach a patch against 1.0.3.2 which maps tg_paginate_limit=0 to the meaning please display all the data available.

.. _[*]: https://hosted.fedoraproject.org/projects/bodhi/ticket/150

Attachments

turbogears-1.0.3-paginate.patch (479 bytes) - added by toshio on 12/13/07 13:36:19.
Patch to handle tg_paginate_limit=0

Change History

12/13/07 13:36:19 changed by toshio

  • attachment turbogears-1.0.3-paginate.patch added.

Patch to handle tg_paginate_limit=0

12/14/07 10:51:17 changed by lmacken

  • cc set to lmacken@redhat.com.

12/15/07 08:55:27 changed by roger.demetrescu

  • status changed from new to closed.
  • resolution set to fixed.

Applied a slightly version of your patch in r3824 and r3825.

Thanks !