On Mon, 2008-09-15 at 14:10 -0700, Ken Arnold wrote:
> I previously brought up a URL resolution refactoring (http://
> groups.google.com/group/django-developers/browse_thread/thread/
> e16bcd24f9e27062/a84b8e58fe2e7786), and was wisely told to hold off on
> it. I thought this might be a good time to bring it up again.
> 
> I'm just going to suggest the simplest thing that might possibly work;
> please comment.
> 
> URL resolver interface:
> - resolve(path) returns (view_function, args, kwargs), just like
> existing interface
> - reverse(name, *a, **kw) returns URL path
> 
> That's not new. Here's the difference: a URL configuration /is/ a
> resolver. We just abstract the special case about importing a module.
> For example, an AdminSite is a resolver. It can just inherit from
> RegexURLResolver (or whatever). Instead of the ad-hoc resolver in
> 'root', it has a 'resolve' method that maybe checks a few special
> cases and then calls super.resolve.

You don't mention what problem are you trying to solve with this change?
Sure, we could do this and certainly make it fully backwards compatible,
but why is it needed?

You can already put any object you like that has a resolve() method into
urlpatterns(). That object can see every single pattern that passes
through if it is matched for the pattern ''. We have to *some* kind of
root object and it happens to be RegexURLResolver.

Right now, in various pieces of client code, I've written classes that
variously (a) implements Joe Gregorio's URL patterns, (b) adds support
for "name=" prefixes on included URL patterns and (c) looks up the URL
correspondence via an external script to determine where to dispatch to.

All three of these were written to meet various client needs and work
quite happily as part of urlpatterns(). I can't think of a case where
I've needed something above that. You clearly have something in mind, so
time to spill the beans (please).

Regards,
Malcolm


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