2010/11/19 Chris McDonough <chr...@plope.com>:
> If we consider conversion-marker-in the pattern a must-have (I don't
> think it is TBH, because we already have it via custom route
> predicates), whatever solution we come up with should take into account
> the case of someone just wanting to do an unanticipated matching
> (probably via a regex) without stopping to create a converter/matcher
> utility.

+1.

How about having some rule that stipulates that if we have a callable,
consider it as a converter, otherwise it's a regex.

def month_converter(value):
    min = 1
    max = 12
    value = int(value)
    if min <= value <= max:
        return value


r = routehelper(config, converters=dict(int="\d+", month=my_month_converter)
r.add_handler('articles', '/articles/{action}/{id:int}', handler=....)
r.add_handler('month_archives', '/archives/{month:month}'...)

-- 
Alex | twitter.com/alexconrad

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