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

Changeset 1342

Show
Ignore:
Timestamp:
09/08/06 21:08:41
Author:
fumanchu
Message:

Got rid of cherrypy.request.path. Use request.script_name + request.path_info instead (usually, just path_info is what you really want).

Files:

Legend:

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

    r1338 r1342  
    4848    e.g., HTTPRedirect(newUrl). Multiple URLs are allowed. If a URL is 
    4949    absolute, it will be used as-is. If it is relative, it is assumed 
    50     to be relative to the current cherrypy.request.path
     50    to be relative to the current cherrypy.request.path_info
    5151    """ 
    5252     
     
    208208        if path is None: 
    209209            import cherrypy 
    210             path = cherrypy.request.path 
     210            path = cherrypy.request.script_name + cherrypy.request.path_info 
    211211        self.args = (path,) 
    212212        HTTPError.__init__(self, 404, "The path %r was not found." % path) 
  • trunk/cherrypy/_cprequest.py

    r1338 r1342  
    437437             
    438438            self.method = method 
    439             self.path = path or "/" 
     439            path = path or "/" 
    440440            self.query_string = query_string 
    441441             
     
    471471            # app root (script_name) to the handler. 
    472472            self.script_name = self.app.script_name 
    473             self.path_info = self.path[len(self.script_name.rstrip("/")):] 
     473            self.path_info = path[len(self.script_name.rstrip("/")):] 
    474474             
    475475            # Loop to allow for InternalRedirect. 
  • trunk/cherrypy/_cptree.py

    r1338 r1342  
    238238        """The script_name of the app at the given path, or None. 
    239239         
    240         If path is None, cherrypy.request.path is used. 
     240        If path is None, cherrypy.request is used. 
    241241        """ 
    242242         
    243243        if path is None: 
    244244            try: 
    245                 path = cherrypy.request.path 
     245                path = cherrypy.request.script_name + cherrypy.request.path_info 
    246246            except AttributeError: 
    247247                return None 
     
    260260        """Return 'path', prefixed with script_name and base. 
    261261         
    262         If script_name is None, cherrypy.request.path will be used 
     262        If script_name is None, cherrypy.request will be used 
    263263        to find a script_name. 
    264264         
  • trunk/cherrypy/lib/cptools.py

    r1339 r1342  
    242242    def run(self): 
    243243        request = cherrypy.request 
    244         path = request.path 
     244        path = request.path_info 
    245245        if path.endswith('login_screen'): 
    246246            return self.login_screen() 
  • trunk/cherrypy/test/test_objectmapping.py

    r1338 r1342  
    7474    class Dir2: 
    7575        def index(self): 
    76             return "index for dir2, path is:" + cherrypy.request.path 
     76            return "index for dir2, path is:" + cherrypy.request.path_info 
    7777        index.exposed = True 
    7878         
     
    177177             
    178178            self.getPage("/dir1/dir2/") 
    179             self.assertBody('index for dir2, path is:%s/dir1/dir2/' % prefix
     179            self.assertBody('index for dir2, path is:/dir1/dir2/'
    180180             
    181181            # Test omitted trailing slash (should be redirected by default). 

Hosted by WebFaction

Log in as guest/cpguest to create tickets