Issue #591 resolved

parameters never get reset with internal redirect for urls with ? only or no ?

guest
created an issue

I've spent some more time on the trunk and here are my current issues:

  1. There is a bug in _cprequest: (in the run function) with the following line:

{{{ if qs: self.params = http.parse_query_string(qs) }}}

Even if there is '?' in the url for an internalredirect, qs gets set to "" and the params never get reset. When I remove the <if qs> check from the above line and everything works.

Other concern:

I don't understand in what case would you want the old parameter's to be passed implicently on an Internal Redirect. It should be explicit. If you need the old parameters then you should build them in your url when you raise an InternalRedirect

Comments (3)

  1. Robert Brewer

    Er.. not sure where you think qs is set to "". _cprequest.run says:

    # Add the *previous* path_info + qs to self.redirections.
    if qs:
        qs = "?" + qs
    self.redirections.append(pi + qs)
    
    pi = self.path_info = ir.path
    qs = self.query_string = ir.query_string
    if qs:
        self.params = http.parse_query_string(qs)
    

    and ir.query_string is set in _cperror:

    def __init__(self, path):
        import cherrypy
        request = cherrypy.request
        
        self.query_string = ""
        if "?" in path:
            # Separate any params included in the path
            path, self.query_string = path.split("?", 1)
    

    If you could provide a small example of code that is failing, I could fold it into the test suite.

  2. Log in to comment