-
-
Notifications
You must be signed in to change notification settings - Fork 7k
add test for force_authenticate about cache of user attr #4102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I cannot see any way we could possible resolve this. Yes, We might want to document this as a limitation, but I don't believe there's any way we can resolve it. Does that assessment sound correct? |
I found that Django's force_login works correctly. |
Are you sure? A brief look at the code here and here indicates that the user object would be cached similarly to @lexdene - could you rebase the PR? This will re-trigger the travis build which seems to be missing for the second commit with the |
@rpkilby As travis said:
|
OK, I have a query here:
Those three things are not consistent. I'll look again/deeper later. Input/clarification welcome! 🙂 |
Milestoning to keep on my radar. |
@carltongibson |
@lexdene Currently yes, that would help. |
@carltongibson
|
…in case you’re reusing the same in-memory user whilst updating it in the DB. Closes encode#5016, closes encode#5066, closes encode#4102
Closing this in favour of #5445. You need to call |
First, the best way to know whether an
OneToOneField
field exists is usinghasattr
.Second,
force_authenticate
will cache the user object.So using
force_authenticate
will cause a bug as I wrote in the test.But using
client.login
will not cause that bug.