Ticket #2302 (closed defect: fixed)
[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
Change History
Changed 3 years ago by chrisz
-
attachment
paginate.patch
added
comment:1 Changed 3 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 3 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.
Note: See
TracTickets for help on using
tickets.
improved paginate decorator