Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1629 (closed defect: fixed)

Opened 12 years ago

Last modified 9 years ago

Give tg_paginate_limit=0 a useful meaning

Reported by: toshio Owned by: anonymous
Priority: normal Milestone: 1.0.4
Component: TurboGears Version:
Severity: normal Keywords:
Cc: lmacken@…


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 which maps tg_paginate_limit=0 to the meaning please display all the data available.

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


turbogears-1.0.3-paginate.patch Download (479 bytes) - added by toshio 12 years ago.
Patch to handle tg_paginate_limit=0

Change History

Changed 12 years ago by toshio

Patch to handle tg_paginate_limit=0

comment:1 Changed 12 years ago by lmacken

  • Cc lmacken@… added

comment:2 Changed 12 years ago 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 !

Note: See TracTickets for help on using tickets.