Re: Couple of issues with migrating from 2.2 -> 3.0

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Couple of issues with migrating from 2.2 -> 3.0

Robert Brewer
pytrade wrote:
> In 3.0 I could not use request.redirections
> since it does not include the parameters
> passed to the InternalRedirect.

It does now. I'd be interested to know if the recent changes* fixed all your issues with redirects.


Robert Brewer
System Architect
Amor Ministries
[hidden email]

* http://www.cherrypy.org/ticket/584 and http://www.cherrypy.org/changeset/1400


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

winmail.dat (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Couple of issues with migrating from 2.2 -> 3.0

pytrade

I checked out the trunk and the changes don't seem to work. After I
raise an InternalRedirect the parameters from the original request
(from the browser url) get passed on the redirected request. Regardless
of whether '?' or not is inthe url.

After looking at _cperror.py I see the following code:

    If you supply a query string, it will replace request.params.
    If you omit the query string (no question mark), the params from
the
    original request will remain in effect.
    To erase any query string parameters, write url + "?" with no
params.
    """
    self.query_string = ""
    if "?" in path:
            # Separate any params included in the path
            path, self.query_string = path.split("?", 1)


self.query_string is being set to "" regardless of whether '?' is in
the url or not.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Couple of issues with migrating from 2.2 -> 3.0

pytrade

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, qs gets set to "" and the params
never get reset. When I remove the <if qs> check from the above line
and everything works. 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

2. The cherrypy.url() function returns an absolute url and if I pass
that value to cherrypy.InternalRedirect it fails.
cherrypy.InternalRedirect only works with relative urls. Eitehr we
should make cherrypy.InternalRedirect work with both absolute or
relative urls or should have cherrypy.url just show the relative urls.
I wrote the following function to get around this problem:

def getCurrentPageUrl():

    url = cherrypy.url()

    urlParts = urlparse(url)

    if urlParts[4]:

        url = urlParts[2]+ '?' + urlParts[3]

    else:

        url = urlParts[2]

    return urllib.quote(url)



Thanks,

Vineet
founder, www.eswap.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---