On Wed, Nov 17, 2010 at 10:27 PM, Chris McDonough <chr...@plope.com> wrote:
> On Wed, 2010-11-17 at 21:22 -0800, Mike Orr wrote:
>> On Wed, Nov 17, 2010 at 7:10 PM, Chris McDonough <chr...@plope.com> wrote:
>> > - The pylons_* paster templates erroneously used the ``{squiggly}``
>> >  routing syntax as the pattern supplied to ``add_route``.  This style
>> >  of routing is not supported.  They were replaced with ``:colon`` style
>> >  route patterns.
>>
>> Is the {varname} syntax not going to be added then? Routes switched
>> from ":varname" to "{varname}" because it allowed us to deprecate
>> another syntax structure ":(group_route)", which was used when the
>> varname was followed by a letter/number/underscore -- something that
>> would be interpreted as part of the varname. If it's not added, we'll
>> have to tell people to go back to the colon syntax after telling them
>> the braces syntax is superior and making them switch to that.
>
> Ben and I talked about supporting the braces syntax recently, and the
> last decision I remember was to not support it because a) the colon
> syntax has continue to be supported for BFG BW compat, and b) the braces
> syntax required a good bit of documentation without any (at least in the
> way we were thinking of supporting it) upside.
>
> 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.

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?

/articles/{id:\d+}         # ID must be numeric or no match

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

-- 
Mike Orr <sluggos...@gmail.com>

-- 
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