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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to