pass entire request object to urlresolver

104 views
Skip to first unread message

Elephant Liu

unread,
Jun 14, 2016, 8:20:59 AM6/14/16
to Django developers (Contributions to Django itself)
Hi all, I'd like to introduce a new feature to django urlresolver.

Currently, django urlresolver can only handle the path_info field of request object.

code from django.core.handlers.base.BaseHandler.get_response
callback, callback_args, callback_kwargs = resolver.resolve(request.path_info)

I'd like to pass the entire request object to urlresolver so that I can implement more complex url resolving logic.
For example:
* base on path and http method
* base on path and http header (such as User-Agent)

I'd like to make a demo if you agree with my idea.

At last, forgive my bad English.

Tim Graham

unread,
Jun 15, 2016, 10:50:44 AM6/15/16
to Django developers (Contributions to Django itself)
I believe that's implemented as part of Marten's URL dispatcher work: https://github.com/django/django/pull/5578.

Elephant Liu

unread,
Jun 15, 2016, 10:38:00 PM6/15/16
to Django developers (Contributions to Django itself)
Yes! That's it.
Thank you.

在 2016年6月15日星期三 UTC+8下午10:50:44,Tim Graham写道:
Reply all
Reply to author
Forward
0 new messages