[Chicago] Pylons/Groovie Routes Help

Ian Bicking ianb at colorstudy.com
Wed Apr 30 05:50:26 CEST 2008


Daniel Griffin wrote:
> Well, ideally you could just go /gecsjob/edit/BAT/JOB/11:11:09 4/29/2008 

Then maybe you want:

   map.connect('/gecsjob/edit/BAT/JOB/:time/:month/:day/:year')

?  I'm not sure which of these are variables.

Also, if you have some fixed set of things, you can do:

map.connect('/:controller/:action/:group/:type/:time/:month/:day/:year',
   requirements=dict(action='(edit|create|delete)', group='BAT|SINGLE', 
type='JOB|ASSIGNMENT', time=r'\d\d:\d\d:\d\d', month=r'\d\d', 
day=r'\d\d', year=r'\d\d\d\d'))

Then you can restrict this more carefully.

> and it would bring you to the edit page for that job. The standard 
> /:controller/:action/:id wont do that because it is expecting a single 
> key correct? That is a major source of confusion for me since I dont 
> know how these routes will deal with all sorts of crazy keys.

:id in that case would be restricted to a single segment, yes.  I think 
you could use *id, which would allow any number of segments to be matched.


-- 
Ian Bicking : ianb at colorstudy.com : http://blog.ianbicking.org


More information about the Chicago mailing list