[patch] Make urlresolver configureable
|Reported by:||django@…||Owned by:||adrian|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Currently the urlresolver is fix in the http.base module, which doesn't allow to customize how url's get resolved.
This patch implements a new config variable URL_RESOLVER which points to a class that will be used for resolving the url, makeing it easy to customize the behaviour of the django installation. For example, you could easy implement a weblog hosting where USER.example.org ist the weblog of the user, without touching apache. Or even use a database driven resolver.
The class will be initialized a little bit different then the current RegexURLResolver, because the request object is very usefull for a resolver class.
This patch also implements a HostURLResolver which also matches the hostname through a regular expression.
Note: The urlpatterns a different for this resolver:
urlpatterns = ( (r'bla', patterns('', ... )), (r'^localhost$', patterns('', # Uncomment this for admin: (r'^admin/', include('django.contrib.admin.urls.admin')), )), )
But it's for more advanced yours anyway, but I think it will be usefull for many people. The HostURLResolver is not that big, so i put it into core.urlresolvers.
Change History (11)
comment:5 Changed 8 years ago by anonymous
- Resolution wontfix deleted
- Status changed from closed to reopened
comment:6 Changed 8 years ago by adrian
- Resolution set to wontfix
- Status changed from reopened to closed