#2303: Problems when combining @paginate and @validate
------------------------+---------------------------------------------------
Reporter: chrisz | Owner:
Type: defect | Status: new
Priority: normal | Milestone: 2.0
Component: TurboGears | Version: 2.0b7
Severity: normal | Keywords: paginate validate
------------------------+---------------------------------------------------
In TG 2.0, if you add a paginate decorator to a controller that has
already a validate decorator, like this
{{{
@validate(...)
@paginate(...)
}}}
then the controller does not get the validated parameters any more, but
gets only the raw parameters instead.
If you do it the other way around,
{{{
@paginate(...)
@validate(...)
}}}
then the validate will stumble over the additional `page` parameter.
The first problem can be solved with the proposed fix #2302 which makes
the paginate decorator much cleaner and independent of the order of the
decorators. However, this does not solve the second problem.
This second problem is caused by
[http://trac.turbogears.org/browser/trunk/tg/controllers.py#L181 these]
two lines in `tg.controller`:
{{{
if isinstance(controller.im_self, DecoratedController):
params.update(pylons.request.params.mixed())
}}}
Even though the paginate decorator removes the `page` key from `params`,
this update statement mixes it back in, and it is passed to the
controller.
Do we really need these lines? What are they good for?
--
Ticket URL: <http://trac.turbogears.org/ticket/2303>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---