18 messages in com.googlegroups.pylons-discussRe: Routes user survey| From | Sent On | Attachments |
|---|---|---|
| Mike Orr | 23 Nov 2007 01:36 | |
| Marcin Kasperski | 23 Nov 2007 04:30 | |
| Paweł Stradomski | 23 Nov 2007 05:46 | |
| Mike Orr | 23 Nov 2007 05:50 | |
| Mike Orr | 23 Nov 2007 06:06 | |
| Paweł Stradomski | 23 Nov 2007 06:18 | |
| Mike Orr | 23 Nov 2007 07:31 | |
| Paweł Stradomski | 23 Nov 2007 07:34 | |
| Mike Orr | 23 Nov 2007 08:37 | |
| Jose Galvez | 23 Nov 2007 10:34 | |
| Ben Bangert | 23 Nov 2007 15:34 | |
| Ian Bicking | 23 Nov 2007 21:56 | |
| Andrew Smart | 24 Nov 2007 11:04 | |
| Ian Bicking | 24 Nov 2007 13:59 | |
| Mike Orr | 26 Nov 2007 16:16 | |
| Jonathan Vanasco | 18 Dec 2008 16:43 | |
| Mike Orr | 18 Dec 2008 18:35 | |
| Ben Bangert | 19 Dec 2008 08:34 |
| Subject: | Re: Routes user survey![]() |
|---|---|
| From: | Mike Orr (slug...@public.gmane.org) |
| Date: | 11/26/2007 04:16:05 PM |
| List: | com.googlegroups.pylons-discuss |
I've suspended my changes in light of Ben's new API, which is now partly implemented.
I don't understand what exactly minimization means, and how eliminating it changes Routes. Section 3.1 of the manual says:
1 m.connect(':controller/:action/:id', action='view', id=4) 2 3 # Will match all of the following 4 # /content/view/4 5 # /content/view 6 # /content
Does this mean that using the new map.dynamic(), only /content/view/4 will match? What if I want the others to match too, specifically in the case of "/foo" vs "/foo/" vs "/foo/index"?
Does this clear up the problem of matching nonsense routes like "/archives/view-" (missing ID), or will we still have to handle this the same way?
Will 'action' and 'id' continue to be implicit arguments, or will they have to be specified in every route?
What about on the generation side? I gather that minimization is what makes url_for("name") choose the wrong route. But what is its other impact? Routes 1 would leave out variables in the URL if the defaults would match the same route?
On Nov 23, 2007 3:34 PM, Ben Bangert
<ben-...@public.gmane.org> wrote:
Regarding url_for(controller='account', action='home'), I have no idea why this is regarded as an abomination nor do I have any plans on dropping such a critical piece of functionality. In apps I've worked on with 50+ controllers, with a dozen or more actions per controller, it'd be an abomination to have to name every damn route. :)
Routes decouples the URLs from the actions. This allows you to rename or move actions without affecting the URLs, or conversely to reorganize the URLs without changing your controllers.
Named routes decouple the actions from the templates. Otherwise you're hardwiring the names of controllers and actions in your templates and wherever else url_for is called, and if you move actions around you have to change your templates. That's a violation of MVC, tying the templates to a specific controller implementation. Better to give the routes meaningful logical names and arguments. For instance, I want to show incident 23:
url_for("incident", incident_id=23, printable=1)
url_for(controller="main", action="incident", id=23, printable=1) # Oops, I want to move it to controller "incident" action "index".
url_for("/incident", incident_id=23, printable=1) # Oops, I want to change the URL.
-- Mike Orr <slug...@public.gmane.org>




