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

Changeset 766

Show
Ignore:
Timestamp:
10/31/05 12:19:37
Author:
fumanchu
Message:

Fix for #372 (browserUrl and querystrings).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/cherrypy-2.1/cherrypy/_cperror.py

    r710 r766  
    6666        import cherrypy 
    6767        import cgi 
     68        request = cherrypy.request 
    6869         
    6970        # Set a 'path' member attribute so that code which traps this 
     
    7374        if params is not None: 
    7475            if isinstance(params, basestring): 
    75                 cherrypy.request.queryString = params 
     76                request.queryString = params 
    7677                pm = cgi.parse_qs(params, keep_blank_values=True) 
    7778                for key, val in pm.items(): 
    7879                    if len(val) == 1: 
    7980                        pm[key] = val[0] 
    80                 cherrypy.request.paramMap = pm 
     81                request.paramMap = pm 
    8182            else: 
    82                 cherrypy.request.queryString = urllib.urlencode(params) 
    83                 cherrypy.request.paramMap = params.copy() 
    84          
    85         cherrypy.request.browserUrl = cherrypy.request.base + path 
     83                request.queryString = urllib.urlencode(params) 
     84                request.paramMap = params.copy() 
     85         
     86        request.browserUrl = request.base + path 
     87        if request.queryString: 
     88            request.browserUrl += '?' + request.queryString 
    8689 
    8790 
     
    109112            #  2. a URL relative to root (e.g. "/dummy") 
    110113            #  3. a URL relative to the current path 
     114            # Note that any querystring in browserUrl will be discarded. 
    111115            url = urlparse.urljoin(cherrypy.request.browserUrl, url) 
    112116            abs_urls.append(url) 
  • trunk/cherrypy/_cperror.py

    r762 r766  
    6666        import cherrypy 
    6767        import cgi 
     68        request = cherrypy.request 
    6869         
    6970        # Set a 'path' member attribute so that code which traps this 
     
    7374        if params is not None: 
    7475            if isinstance(params, basestring): 
    75                 cherrypy.request.queryString = params 
     76                request.queryString = params 
    7677                pm = cgi.parse_qs(params, keep_blank_values=True) 
    7778                for key, val in pm.items(): 
    7879                    if len(val) == 1: 
    7980                        pm[key] = val[0] 
    80                 cherrypy.request.paramMap = pm 
     81                request.paramMap = pm 
    8182            else: 
    82                 cherrypy.request.queryString = urllib.urlencode(params) 
    83                 cherrypy.request.paramMap = params.copy() 
    84          
    85         cherrypy.request.browserUrl = cherrypy.request.base + path 
     83                request.queryString = urllib.urlencode(params) 
     84                request.paramMap = params.copy() 
     85         
     86        request.browserUrl = request.base + path 
     87        if request.queryString: 
     88            request.browserUrl += '?' + request.queryString 
    8689 
    8790 
     
    109112            #  2. a URL relative to root (e.g. "/dummy") 
    110113            #  3. a URL relative to the current path 
     114            # Note that any querystring in browserUrl will be discarded. 
    111115            url = urlparse.urljoin(cherrypy.request.browserUrl, url) 
    112116            abs_urls.append(url) 

Hosted by WebFaction

Log in as guest/cpguest to create tickets