On Nov 18, 2010, at 8:11 AM, Mike Orr wrote:

>> That said, I didn't personally consider the case where the desired
>> return value of the pattern "/:x_html" might be {'x':'foo'} instead of
>> {'x_html':'foo_html'} when the matched path was "/foo_html".  I'm not
>> sure if Ben did either.

As I was building a pyramid app the other day, I did come across this actually. 
It was part of the reason I was asking about an easier way to sub in a custom 
regex for just the path part (rather than having to supply an entire path_info 
and build the regex myself). Because then I could at least make my own add-on 
that support {syntax} with optional regex provided.

> Here's the corresponding part in the Routes manual (in the ":variable" 
> section)
> 
> http://routes.groovie.org/uni_redirect_rest.html#backward-compatibility
> 
> /articles/{year}_{id}   # Some users have wanted to do this
> /records/by_{name}  # This works with the current syntax, but it
>                                     shows how pp use route variables
> 
> By the way, how do you do pattern restrictions?

It's sort of clunky, see above. Right now a path_info can be supplied which is 
used as the entire regex for the whole path, which isn't very convenient. I'm 
going to look at a small patch that supports replacing just individual regex 
parts which will prolly make path_info obsolete unless there's some use-case 
for both options.

> How do you handle a swath of redirects or 4xx/5xx conditions? Routes
> has redirect routes and failure routes for these, and they avoid the
> need for a bunch of stub views, especially for legacy URLs.
> 
> http://routes.groovie.org/uni_redirect_rest.html#redirect-routes

This can also be done externally in a routehelper package, which I'm actually 
going to work on some today.

Cheers,
Ben

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To post to this group, send email to pylons-de...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-devel?hl=en.

Reply via email to