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 #1889 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

paginate works only with tg.strict_parameters = True

Reported by: chrisz Owned by: anonymous
Priority: normal Milestone: 1.1b1
Component: TurboGears Version: 1.1 HEAD
Severity: major Keywords: paginate strict_parameters
Cc:

Description

The paginate decorator works fine with tg.strict_parameters = True as set in the default dev.cfg, but this is not the default and not set in the sample prod.cfg. In this case, if tg.strict_parameters = False, then paginate works only for methods having the paginate parameters explicitly declared or catching additional parameters with **kwargs. The reason is that if you set tg.strict_parameters = False, then all additional parameters are thrown away by TurboGears with adapt_call(), including the paginate parameters, so paginate never sees them.

Something should be done about this, since it's pretty confusing when paginate suddenly stops working in production.

See also  this thread on the turbogears mailing list.

Attachments

paginate_strict.patch Download (1.8 KB) - added by chrisz 6 years ago.
Patch for allowing paginate with strict_parameters

Change History

comment:1 Changed 6 years ago by Chris Arndt

As an intermediate measure, I have put a reference to this ticket in the FAQ list at the end of the  paginate documentation.

comment:2 Changed 6 years ago by faide

This one is a tough one. What kind of fix do you propose chrisz ?

Changed 6 years ago by chrisz

Patch for allowing paginate with strict_parameters

comment:3 Changed 6 years ago by chrisz

I have added a patch that makes paginate work with strict_parameters=False. It adds an attribute for declaring a set of such additional parameters for a controller method and modifies paginate so that it sets this attribute for the paginated function.

comment:4 Changed 6 years ago by Chris Arndt

Patch looks good. Test please?

The paginate decorator function could use some refactoring (in TG 1.1). It's now over 200 lines of code long!

comment:5 Changed 6 years ago by chrisz

  • Version changed from 1.0.5 to 1.1 HEAD
  • Milestone changed from 1.0.x bugfix to 1.1 beta 1

Checked in with tests in r5311 for TG 1.0, need to port this to TG 1.1 and 1.5. (In 1.1 paginate is already a bit simpler because deprecated stuff like support for 'tg_paginate_' parameters and Py 2.3 has been removed, though some refactoring would still be good.)

comment:6 Changed 6 years ago by chrisz

  • Status changed from new to closed
  • Resolution set to fixed

Ported to TG 1.1 and 1.5 in r5318.

Note: See TracTickets for help on using tickets.