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

Opened 10 years ago

Last modified 9 years ago

[PATCH] Improved TG2 paginate decorator

Reported by: chrisz Owned by:
Priority: normal Milestone: 2.1rc1
Component: TurboGears Version: 2.0rc1
Severity: normal Keywords: paginate
Cc:

Description

This patch improves the TG2 paginate decorator in several ways:

  • it uses the TG2 Decoration object instead of decorating the controller manually, because
    • at least inside the decorator module, we should eat our own dogfood
    • this makes it independent of the order of decorators, particularly validate (this was a problem before, you could not write paginate after validate)
  • if items_per_page is changed via URL parameter, then this is now inherited to the paginate links as well (before the setting was lost when clicking on a paginate link)
  • you can now set an upper limit to the items_per_page parameter when passed via the URL (as it was possible in TG1)

Attachments

paginate.patch Download (8.6 KB) - added by chrisz 10 years ago.
improved paginate decorator

Change History

Changed 10 years ago by chrisz

improved paginate decorator

comment:1 Changed 10 years ago by chrisz

Note that even though the paginate decorator removes the page key from the params, the validate decorator mixes it back again. I think this is a problem of the tg.controllers module, not a problem of the paginate decorator (see #2303).

comment:2 Changed 10 years ago by percious

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

This has been applied to 2.1 trunk, and I don't think we should apply it to 2.0 trunk. Let's leave 2.0 where it is.

comment:3 Changed 10 years ago by chrisz

Right, I actually meant this to go into 2.1 since 2.0 was in feature freeze already.

comment:4 Changed 9 years ago by percious

  • Milestone changed from 2.1 to 2.1rc1
Note: See TracTickets for help on using tickets.