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 #2303: fix_r6566_t2303.diff

File fix_r6566_t2303.diff, 1.4 KB (added by anthonyt, 3 years ago)

Simplify setting params in DecoratedController? and ObjectDispatch? controller. Avoids bug in re-setting params, and ensures params are set for routed & dispatched requests.

  • tg/controllers.py

    diff --git tg/controllers.py tg/controllers.py
    index 36bf1e5..fc1e017 100644
    class DecoratedController(WSGIController): 
    129129        rendering. 
    130130        """ 
    131131 
     132        # Add the GET/POST request params to our params dict, overriding any defaults passed in. 
     133        params.update(pylons.request.params.mixed()) 
     134 
    132135        self._initialize_validation_context() 
    133136        pylons.request.start_response = self.start_response 
    134137 
    class DecoratedController(WSGIController): 
    204207        be FormEncode Invalid objects. 
    205208        """ 
    206209 
    207         # this is here because the params were not getting passed in on controllers that 
    208         # were mapped with routes.  This is a fix, but it's in the wrong place. 
    209         # we need to add better tests to ensure decorated controllers with routings work 
    210         # properly. 
    211  
    212210        validation = getattr(controller.decoration, 'validation', None) 
    213211 
    214212        if validation is None: 
    class ObjectDispatchController(DecoratedController): 
    468466            pylons.c.controller_url = url 
    469467        if remainder and remainder[-1] == '': 
    470468            remainder.pop() 
    471         return controller, remainder, pylons.request.params.mixed() 
     469        return controller, remainder, {} 
    472470 
    473471    def _perform_call(self, func, args): 
    474472        controller, remainder, params = self._get_routing_info(args.get('url'))