Ben Bangert wrote: > On Feb 7, 2007, at 12:30 PM, Chris Shenton wrote: > >>> FWIW, there will be no way for Routes to distinguish an incoming >>> request >>> for FastEnet-10/100 from FastEnet-10%2f100 -- WSGI/CGI dictates >>> that the >>> path is decoded before it is sent to Routes, so the two end up the >>> same. >> I didn't realize that. So even if generate() explicitly >> quote_plus()'d its kwargs, routes would still see naked slashes? >> >> Any suggestion on the best way to get around this so I can have args >> that do contain slashes? > > Given that a WSGI server can decide to un-escape args so that the > slashes will be put in, I see no way for Routes to deal with this. It > purposely leaves slashes in should you pass them in for an arg, which > is what you'd want in the case of the *text arg that your route > takes, since it can match slashes... Adding logic to sometimes escape > slashes, and sometimes not escape them would hinder predictability on > how Routes is going to generate the url, plus as Ian noted there's no > guarantee the escaped slash will stay escaped before Routes next sees > it. > > If you require slashes in an argument, I'd suggest having them be > query arguments, as those are URL escaped and peeled off before > Routes does its match.
The other alternative, of course, is to simply normalize these kinds of arguments, e.g., replace / with _. Or I suppose you could double-escape them (remembering of course to unescape them). -- Ian Bicking | [EMAIL PROTECTED] | http://blog.ianbicking.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" 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/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
