(after additional reconsideration)

I think that the - with respect to the current behaviour - whole
term 'named route' and mapper syntax is misleading.

Let's once more take a look at the original example:

  >>> from routes import *
  >>> m = Mapper()
  >>> m.connect('gallery_thumb', 'images/gallery/:(image_id)_thumbnail.jpg')
  >>> m.connect('gallery', 'images/gallery/:(image_id).jpg')
  >>> url_for('gallery_thumb', image_id=1)
  '/images/gallery/1_thumbnail.jpg'

Is the name 'gallery_thumb' in any way related to the url
'images/gallery/:(image_id)_thumbnail.jpg'? Is there any
association made between the two?

No! The syntax above does not - with the current algorithm - bring any
association between the name and the url (route).

So ... isn't the name 'named route' just misleading?

Let's now see what is it bringing us? Quoting your example:

  >>> m.connect('gallery_thumb', 
'images/gallery/:(image_id)_:(image_size).jpg', image_size='thumbnail')
  >>> m.connect('gallery', 'images/gallery/:(image_id).jpg')
  >>> url_for('gallery_thumb', image_id=1)
  '/images/gallery/1_thumbnail.jpg'
  >>> url_for('gallery', image_id=1)
  '/images/gallery/1.jpg'

As you already explained, the 'gallery_thumb' name is bringing us
*only* one thing: default parameter image_size='thumbnail'.

What surely could be better expressed by some other syntax. For
example:

  >>> m.alias('gallery_thumb', image_size='thumbnail')

Also, it is of course just an alias/macro/parameter set/.... It is
in no way *named route*.

Note that in this very thread you already have three different
people who happened to be confused by the current behaviour.

I think that 'named routes' can be very useful in complicated url
construction cases, but only if they do what the name suggest
- enforce using the named rule.



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