Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1128

Show
Ignore:
Timestamp:
06/08/06 00:50:48
Author:
fumanchu
Message:

Fix for #507 (InternalRedirect? supports only absolute paths). Paths relative to script_name are now possible by omitting the leading slash from the path.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/_cperror.py

    r1125 r1128  
    3131        import cherrypy 
    3232        request = cherrypy.request 
     33         
     34        # Note that urljoin will "do the right thing" whether url is: 
     35        #  1. a URL relative to root (e.g. "/dummy") 
     36        #  2. a URL relative to the current path 
     37        # Note that any querystring will be discarded. 
     38        path = urlparse.urljoin(cherrypy.request.path_info, path) 
    3339         
    3440        # Set a 'path' member attribute so that code which traps this 
  • trunk/cherrypy/test/test_core.py

    r1122 r1128  
    144144        def index(self): 
    145145            raise cherrypy.InternalRedirect("/") 
     146         
     147        def relative(self): 
     148            raise cherrypy.InternalRedirect("cousin") 
     149         
     150        def cousin(self): 
     151            return "I am a redirected page." 
    146152         
    147153        def petshop(self, user_id): 
     
    549555        self.getPage("/internalredirect/secure") 
    550556        self.assertBody('Please log in') 
     557        self.assertStatus(200) 
     558         
     559        # Relative path in InternalRedirect 
     560        self.getPage("/internalredirect/relative") 
     561        self.assertBody('I am a redirected page.') 
    551562        self.assertStatus(200) 
    552563         

Hosted by WebFaction

Log in as guest/cpguest to create tickets