I've run into this too, but haven't gotten around to implementing a 
solution yet. It's an artefact of the WSGI spec inherited from CGI. With 
mod_wsgi you can access the unescaped (but pre any url rewriting) value in 
REQUEST_URI. I'm not sure waitress puts this into the environment too. You 
could have a tween or NewRequest subscriber set the unescaped PATH_INFO 
from REQUEST_URI before url dispatch.

Traversal will be a bit trickier. Following the URI spec grammar would 
suggest splitting first on '/' then unescaping each segment individually. 
Implementing this in a Pyramid app would likely involve subclassing the 
traverser.

Laurence

On Thursday, 8 May 2014 13:22:13 UTC-7, Achim Domma wrote:
>
> Hi,
>
> I have the following two routes in my application:
>
> /{base_id}/{sub_id}/{some_text}
> /{base_id}/{sub_id}
>
> Obviously I assume that none of these parts contains a slash, which has 
> just proven to be wrong. ;-) I have control over some_text, so I can make 
> sure, that it will not contain a slash, but I have to accept slashes in 
> sub_id. I tried to encode them as %2F, but I found out that those are 
> decode before reaching Pyramid. My last resort would be a "greedy" pattern 
> for sub_id, so some_text should contain the value after the last slash and 
> sub_id everything between the second and the last slash. I know that this 
> does not work with the default url matching and that it would be a hack, 
> but is there some way to do that with pyramid? I would be happy to accept 
> more or less every not too intrusive hack.
>
> cheers,
> Achim
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to