José de Paula Eufrásio Júnior wrote:
> I want some URL's to be reached like
>
> http://site.mp/search/http://pythondance.com
>
> Or any other "search string" (the part after search/) that may include
> "/". I tried to use the keywords on a search method, but cherrypy
> splits the URL at '/' and I don't know how to say to it "hey,
> everything after the slash is just one argument..."

CherryPy does that because that's not a syntactically valid
interpretation of the given URL. From http://rfc.net/rfc2396.html#s3.3.

"The path may consist of a sequence of path segments separated by a
single slash "/" character.  Within a path segment, the characters "/",
";", "=", and "?" are reserved."

> I can use the default method, but that would add a lot of joining (in
> case of many '/' on the 'search string').
>
> Is there a better way to treat that?

At the least, escape the slashes which are not intended to be path
segment separators in the original, encoded URL. Use the "% HEX HEX"
encoding to turn:

    http://site.mp/search/http://pythondance.com

into:

    http://site.mp/search/http%3A%2F%2Fpythondance.com

This can be done with urllib.quote("http://pythondance.com";, safe="").

Another, even safer possibility would be to send the embedded URL as a
querystring argument, rather than a path segment:

    http://site.mp/search?url=http%3A%2F%2Fpythondance.com


Robert Brewer
System Architect
Amor Ministries
[EMAIL PROTECTED]


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to