Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#21439 closed Bug (fixed)

UnboundLocalError in auth backends' get_user

Reported by: Matt Robenolt Owned by: nobody
Component: contrib.auth Version: dev
Severity: Normal Keywords: auth, bug, user
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If get_user_model were to raise an exception, it ends up masking that exception and in turn raising UnboundLocalError: local variable 'UserModel' referenced before assignment.

Change History (6)

comment:1 by Matt Robenolt, 11 years ago

Version: 1.61.5

Seems to have been introduced with the first implementation of the new user backends.

https://github.com/django/django/commit/70a0de37d132e5f1514fb939875f69649f103124

Last edited 11 years ago by Matt Robenolt (previous) (diff)

comment:2 by Simon Charette, 11 years ago

Triage Stage: UnreviewedAccepted
Version: 1.5master

comment:4 by Matt Robenolt <matt@…>, 11 years ago

Resolution: fixed
Status: newclosed

In 3560ef043e5c70de30ca7d5d7d6d09c150eb6eb4:

Propagate get_user_model exception from get_user

Fixes #21439

comment:5 by Aymeric Augustin <aymeric.augustin@…>, 11 years ago

In 3e845b79ce9f74c0942e2c41259d33bd835f2941:

Merge pull request #1920 from mattrobenolt/unboundlocalerror

Fixed #21439 -- Propagated get_user_model exception from get_user

comment:6 by Aymeric Augustin <aymeric.augustin@…>, 11 years ago

In 0aa06bd3782d1bf6961ba846ec79aded82daa5c2:

[1.6.x] Propagate get_user_model exception from get_user

Fixes #21439

Backport of 3560ef04 from master.

Conflicts:

django/contrib/auth/tests/test_auth_backends.py

Note: See TracTickets for help on using tickets.
Back to Top