﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
16139	Pass request object to URL resolvers so custom despatchers can use more than just path.	alexdutton	nobody	"I'd like to serve a site on more than one domain using one instance of a Django app. To do this I was thinking of writing a custom URL resolver that looks at the Host header when despatching.

At the moment I can't get at the header without trawling the stack (yuck), so it would be great if the URL resolver were passed the entire request object to play with. In the case of the built-in resolvers it wouldn't be used, but it'd allow others to extend the resolving process in new and exciting ways.

WRT backwards compatibility it gets a bit fun, as we really don't want to be changing the signature of the resolve method. It might be possible to add a new resolve_request method that takes a request object, not a string. If this doesn't exist on the resolver it tries the current way. Any custom resolvers wouldn't know about the new method, but that would only be an issue if they want to use the new functionality.

This can probably be as simple as replacing the current calls to resolve() with:

{{{
try:
    callback, callback_args, callback_kwargs = resolver.resolve_request(request)
except (AttributeError, NotImplementedError), e:
    callback, callback_args, callback_kwargs = resolver.resolve(request.path_info)
}}}

If this is a feature that's looked upon favourably, I'm happy to put a patch together.
"	New feature	closed	Core (URLs)	1.3	Normal	duplicate	urlresolver	alexdutton	Design decision needed	0	0	0	0	0	0
