def get_user(request):
......
code
.....
backend = load_backend(backend_path)
backend,request = request
.....
code
.....
def get_user(request):
...
code
...
backend = load_backend(backend_path)
DjangoObjectBuilder.do_initialize_object(backend, request)
....
code
....
def add_request_to_backend(obj, request):
obj.request = request
DjangoObjectBuilder.add_custom_initializer(lambda obj: isinstance(obj, openstack_auth.Backend), add_request_to_backend)
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/5dffbda9-7239-489e-9530-564df9ab578e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I think Tim’s assessment in the ticket is on point, a DjangoObjectBuilder would look very strange and out of place if included (it’s not particularly pythonic either).
Without studying the openstack code much it's hard for me to say if the solution there is the best approach and that a more elegant solution doesn't exist. It looks like if we added 'request' to the signature of the authentication backend get_user() method, that would remove the need for monkey patching. We did a similar change for the authenticate() method [1], I'm not sure if there would be consensus to make the change.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/9ae497ad-3c48-4cb9-9122-1b67c5186066%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/889705e4-7247-4860-97bd-ee7f0bcbdbc5%40googlegroups.com.