Commit 040b409
committed
Fix UnboundLocalError in render_login() caused by redundant oauth_bb import
The function was attempting to import oauth_bb locally inside the function body,
which caused Python to treat oauth_bb as a local variable throughout the entire
function scope. This resulted in an UnboundLocalError when trying to access
oauth_bb.oauth_check on line 1956, before the import statement on line 1965.
The oauth_bb module is already imported at the module level (lines 69-90) with
proper fallback handling via MockOAuth when OAuth is unavailable. The local
import inside the function is redundant and breaks name resolution.
Solution: Remove the redundant `from . import oauth_bb` import from inside the
render_login() function. The module-level import is sufficient for all uses
within the function.
Fixes: 500 Internal Server Error on login page
Caused by: Commits 29de7bd (import refactoring) and 7c49f5c (incomplete fix)
Related issues:
- Commit 29de7bd: "Fix language selection missing when OAuth/OIDC enabled"
- Commit 7c49f5c: "Fix NameError: oauth_check not defined in render_login()"1 parent 987e700 commit 040b409
2 files changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
315 | | - | |
| 315 | + | |
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
| |||
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
| 386 | + | |
386 | 387 | | |
387 | 388 | | |
388 | 389 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1960 | 1960 | | |
1961 | 1961 | | |
1962 | 1962 | | |
1963 | | - | |
1964 | 1963 | | |
1965 | 1964 | | |
1966 | 1965 | | |
| |||
0 commit comments