﻿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
29005	django object builder	Sergey Glazyrin	nobody	"Hello guys!

I faced a situation where I need to patch django.contrib,auth.get_user function because the ""openstack auth backend"" should be aware of django request.
Let me describe the situation.

We use django-websocket-redis python package for websocket stuff. We do subscribe to user's channels, so, uwsgi_websocket process should be aware of currently signed in user.

For example, here, django websocket redis requires a recognized user in request object
https://github.com/jrief/django-websocket-redis/blob/master/ws4redis/redis_store.py#L22

BUT, the backend we use in our project requires ""request object"" inside to recognize if user signed in.

https://github.com/openstack/horizon/blob/master/openstack_auth/backend.py#L78

And as it suggests, it requires some monkey-patching

  This required monkey-patching the ``contrib.auth`` middleware
  to make the ``request`` object available to the auth backend class.

Instead I propose to add a simple way to do monkey patching directly in django

For such purpose I added simple changes based on ""Builder"" design pattern, so we may build Django object in iterative way and avoid monkey patches at all in different python packages.

https://github.com/django/django/compare/master...sergeyglazyrindev:master

Such change will simplify django object adaptation in another python packages.

What do you think ?"	New feature	closed	Core (Other)	dev	Normal	wontfix	builder 3party		Unreviewed	1	0	0	0	0	0
