On Mar 27, 4:57 pm, "Adrian Holovaty" <[EMAIL PROTECTED]> wrote:

> I've done some thinking on this, too, and I think the cleanest way to
> solve it would be to introduce optional names for URL patterns.
> Something like this:
>
>     url(r'^objects/$', some_view, name='object_view'),
>     url(r'^objects2/$', some_view, name='object_view2'),
>
> This way, you could give an arbitrary name to a particular pattern, so
> that you could target it via a reverse lookup. The Routes package does
> something similar ("named routes"). Note that it would require URL
> patterns to be function calls -- url() -- but that's probably a good
> long-term switch, anyway, because it lets us do more interesting
> things. We could likely keep it backwards compatible by changing the
> patterns() function to convert any plain tuple into an object of the
> type url() returns.

This could be really hot. Pretend for a moment that this url is a
class which has has a regex() method that is called when we, you know,
want to know what the regex should be. This would allow people to
write new url classes that took routes style patterns, or better yet
(IMHO) URI templates [1]. The class would just have to know how to
turn it's configuration arguments into the proper regex. Under the
covers, dispatch still happens via regex, but there are kinder,
gentler, and extensible ways of setting up those regexes without have
to actually write them.

</random_speculation>

Joseph

[1] 
http://bitworking.org/projects/URI-Templates/draft-gregorio-uritemplate-00.html


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

Reply via email to