Ticket #1889 (closed defect: fixed)

Opened 5 months ago

Last modified 3 months ago

paginate works only with tg.strict_parameters = True

Reported by: chrisz Assigned to: anonymous
Priority: normal Milestone: 1.1 beta 1
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 (1.8 kB) - added by chrisz on 08/30/08 06:30:06.
Patch for allowing paginate with strict_parameters

Change History

08/21/08 21:44:30 changed 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.

08/28/08 01:40:11 changed by faide

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

08/30/08 06:30:06 changed by chrisz

  • attachment paginate_strict.patch added.

Patch for allowing paginate with strict_parameters

08/30/08 06:34:14 changed 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.

08/30/08 07:07:24 changed 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!

08/30/08 11:23:42 changed 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.)

08/30/08 12:55:26 changed by chrisz

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

Ported to TG 1.1 and 1.5 in r5318.