[Chicago] Pylons/Groovie Routes Help

Massimo Di Pierro mdipierro at cs.depaul.edu
Wed Apr 30 05:40:49 CEST 2008


Mind that technically (according to specs) ":" should be encoded  
because reserved and " " is considered unsafe.

http://www.blooberry.com/indexdot/html/topics/urlencoding.htm

You should use something like

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

instead.

Massimo

On Apr 29, 2008, at 10:32 PM, Daniel Griffin wrote:

> Well, ideally you could just go /gecsjob/edit/BAT/JOB/11:11:09  
> 4/29/2008
>
> 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.
>
>
> Dan
>
> On Tue, Apr 29, 2008 at 10:08 PM, Ian Bicking <ianb at colorstudy.com>  
> wrote:
> Daniel Griffin wrote:
> Hi,
> I have been working on Pylons for a while now and have run into 1  
> serious issue. I cannot figure out Routes. Can someone help me  
> figure out routes for the following?
>
> users pk - username
> - view(no key needed)
> - new/edit/delete(key needed)
> - find jobs for this user
>
> jobs - pk is batch + job + date entered
> - view(no key needed)
> - new/edit/delete(key needed)
> - assorted other stuff
>
> quickview  - summary view(no key needed)
>
> I dont really have a routes file to post since it is entirely  
> broken, the keys cannot be changed and eventually there will be  
> many entries needed. When I started and only had users the  
> following worked
>
>    map.connect(':controller/:action/:id')
>    map.connect(':controller/:action/:name',  
> controller='gecsuser',action='list')
>    map.connect(':name', controller='gecsuser', action='list',  
> name='Dan')
>
> when I added
>
>  map.connect(':controller/:action/:jobnum/:batch/:submitted',  
> controller='gecsjob',action='index')
>    map.connect(':jobnum', controller='gecsjob', action='index',  
> jobnum='job')
>    map.connect(':batch', controller='gecsjob', action='index',  
> batch='job')
>    map.connect(':submitted', controller='gecsjob', action='index',  
> submitted='9999-12-31 23:59:59')
>
> everything broke. How do I make this work?
>
> Those routes you setup are ambiguous, I think.  ":batch" is just a  
> variable.  By doing batch="job" in that connection you'll just set  
> the default for that variable -- but any (single-segment) URL will  
> match that pattern and overwrite the default.  Since you have three  
> connections like that, they all overlap.
>
> Maybe you want to do:
>
>  map.connect('/job', controller='gecsjob', actino='index',  
> batch='job')
>
> or something like that...?  I'm not sure what URL layout you want.
>
> -- 
> Ian Bicking : ianb at colorstudy.com : http://blog.ianbicking.org
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago
>
> <ATT00001.txt>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20080429/80379ec7/attachment.htm>


More information about the Chicago mailing list