Changeset 3897

Show
Ignore:
Timestamp:
01/12/08 16:03:27 (7 months ago)
Author:
mramm
Message:

Fixed broken test, which did not .folow() the redirect. Also fixed broken redirect implemnetation which set params to {} in the function definition. (So the same params dict was used in all no-params redirects)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tg/controllers.py

    r3890 r3897  
    1919        return self._perform_call(None, None) 
    2020 
    21 def redirect(url, params={}, **kw): 
     21def redirect(url, params=None, **kw): 
    2222    """Generate an HTTP redirect. The function raises an exception internally, 
    2323    which is handled by the framework. The URL may be either absolute (e.g. 
     
    2828    request. 
    2929    """ 
     30    if not params: 
     31        params = {} 
    3032    url = urlparse.urljoin(request.path_info, url) 
    3133    params.update(kw) 
  • trunk/tg/tests/test_tg_controller_dispatch.py

    r3893 r3897  
    1111class SubController(object): 
    1212    @expose() 
    13     def foo(self): 
     13    def foo(self,): 
    1414        return 'sub_foo' 
    1515 
     
    3737class BasicTGController(TurboGearsController): 
    3838    @expose() 
    39     def index(self): 
     39    def index(self, **kwargs): 
    4040        return 'hello world' 
    4141 
     
    137137 
    138138    def test_subcontroller_redirect_subindex(self): 
    139         resp=self.app.get('/sub/redirect_sub') 
     139        resp=self.app.get('/sub/redirect_sub').follow() 
    140140        self.failUnless('sub index' in resp) 
    141141