Opened 11 years ago
Last modified 11 years ago
#24097 closed Bug
Python3 AttributeError with redirect_to_login and lazy LOGIN_URL — at Initial Version
| Reported by: | Peter Schmidt | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.auth | Version: | 1.7 |
| Severity: | Release blocker | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
See discussion on #18776 to decide whether to keep patching symptoms or fix the root cause.
Ran into the same AttributeError: '__proxy__' object has no attribute 'decode'.
Please see attached test_redirect_to_login.diff or https://github.com/mathspace/django/compare/error-lazylogin-master which passes under Python 2.7 but fails under Python 3.4
One workaround is to explicitly pass the string form of the variable, i.e.
redirect_to_login(next=..., login_url=str(settings.LOGIN_URL))