Unfortunately you need to double-escape slashes to get them through a
wsgi-compliant server. If this isn't an option then in Pyramid you could
use a regex in the placeholder of sub_id: {sub_id:some_regex}. If the regex
doesn't get you there then you can make use {sub_id:.*} and assign a custom
predicate to the route which does its own checks of the values prior to
allowing the match through.On Thu, May 8, 2014 at 3:29 PM, Gael Pasgrimaud <[email protected]> wrote: > Hi, > > On Thu, May 08, 2014 at 01:22:13PM -0700, 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. > > I don't think you can have a slash in sub_id but you don't need a «hack» > to do > what you want: > > > http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/hybrid.html#using-subpath-in-a-route-pattern > > > > > 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. > > -- > 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. > -- 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.
