i'm using url dispatch , and I have some routes that begin with this:

      "/by/{username:\w+}"

i now need to support 'id' based urls as well.  e.g.

      "/by/{userid:\-\d+}"

the regexes are actually more complicated, and defined elsewhere.  

there is an approach i think I'd like to pursue, and I think a custom route 
factory might be the solution -- but i'm not sure.  hoping someone can 
point me in the right direction (or offer a better idea).

1.  I'd like to reference an externally defined regex pattern, instead of 
redefining it (multiple times) in my routes.py.   basically, i'd like to 
tie in the validation + routing regexes to avoid potential errors in 
development.

2. i'd like to define a single route, with a single 'identifier' in the 
route declaration -- and to then process it to augment or redefine the 
matchdict to contain the specific matched identifier.

e.g.

          route: "/by/{identifier}"
          url a :  /by/-123 => matchdict = {'identifier': '-123', 'userid': 
'-123'}
          url a :  /by/example=> matchdict = {'identifier': 'example', 
'username': 'example}






    

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

Reply via email to