Opened 5 years ago

Closed 5 years ago

#31114 closed Bug (fixed)

request.build_absolute_uri does not support reverse_lazy

Reported by: Dmitrij Strelnikov Owned by: nobody
Component: Core (URLs) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

redirect_uri = 'google_callback'

print('reverse')
print(request.build_absolute_uri(reverse(self.redirect_uri)))
print('lazy')
print(request.build_absolute_uri(reverse_lazy(self.redirect_uri)))
reverse
SplitResult(scheme='', netloc='', path='/google/callback/', query='', fragment='')
lazy
File "/Users/.pyenv/versions/3.8.1/lib/python3.8/urllib/parse.py", line 108, in <genexpr>
    return tuple(x.decode(encoding, errors) if x else '' for x in args)
AttributeError: '__proxy__' object has no attribute 'decode'

exception is raised by from urllib.parse import urlsplit
I think it's the same issue as https://code.djangoproject.com/ticket/18776

Change History (3)

comment:1 by Claude Paroz, 5 years ago

Easy pickings: set
Triage Stage: UnreviewedAccepted
Type: UncategorizedBug
Version: 3.0master

comment:3 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

Resolution: fixed
Status: newclosed

In e42b68de:

Fixed #31114 -- Fixed HttpRequest.build_absolute_uri() crash with reverse_lazy() locations.

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