#2303: Problems when combining @paginate and @validate
-------------------------------+--------------------------------------------
 Reporter:  chrisz             |        Owner:  deets   
     Type:  defect             |       Status:  reopened
 Priority:  normal             |    Milestone:  2.0     
Component:  TurboGears         |      Version:  2.0b7   
 Severity:  normal             |   Resolution:          
 Keywords:  paginate validate  |  
-------------------------------+--------------------------------------------
Comment (by anthonyt):

 Oops! I just realized that the anthonyt.diff patch I uploaded should
 really have gone onto #2313.

 There's another problem here, though.

 Replying to [ticket:2303 chrisz]:
 > 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?
 >


 In response to the question "What are they good for?": Removing those
 lines prevents kwargs from GET/POST params from getting passed in to
 controller actions when using routes.

 I refer to the comment that was right above the now deleted lines:
 {{{
 # this is here because the params were not getting passed in on
 controllers that
 # were mapped with routes.  This is a fix, but it's in the wrong place.
 # we need to add better tests to ensure decorated controllers with
 routings work
 # properly.
 }}}

 In the current 2.0 code, the params are set once from
 pylons.request.params.mixed() in the ObjectDispatchController. This means
 that any controller that avoids Object Dispatch would not have the
 parameters set. Those two lines were a hack, to re-set the params in the
 DecoratedController, during validation.

 Since, in tg2.0, all useful controllers extend DecoratedController, I've
 moved the original params setting into the DecoratedController's
 _perform_call() method, avoiding the entire problem of setting it twice,
 and ensuring the params are set for Routed and for ObjectDispatched
 requests.

 This is less code and more straightforward. I'll post the patch right
 after this comment.

-- 
Ticket URL: <http://trac.turbogears.org/ticket/2303#comment:12>
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to