Opened 4 years ago

Closed 4 years ago

#22693 closed Bug (wontfix)

DeleteView.success_url set to reverse_lazy URL raises AttributeError when using Python 3.2

Reported by: kelvinwong_ca Owned by: nobody
Component: Python 3 Version: 1.5
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no


The Django 1.5 docs recommend that reverse_lazy be used with the success_url when using DeleteView:

When run with Python 3.2, an exception is raised::

AttributeError: 'proxy' object has no attribute 'decode'

This view raises AttributeError when run under Python 3.2 and later::


    class LazyAuthorDelete(generic.DeleteView):
        model = Author
        success_url = reverse_lazy('authors_list')

This regression test demonstrates the bug when run under Python 3.2. When run
with Python 2.7 there are no exceptions raised.

The trace produced is on Pastebin

Change History (3)

comment:1 Changed 4 years ago by kelvinwong_ca

This issue may be related to:

#19378 HttpResponseRedirect fail on reverse_lazy with Python 3.2

That ticket fixed an issue with FormView where Python 3.2 urlparse had difficulty with the lazy object. This bug is similar.

I propose that the issue is in the DeletionMixin.get_success_url method returning the lazy object. It too needs force_text to return a non-lazy URL.

comment:2 Changed 4 years ago by Baptiste Mispelon

Has patch: set
Needs tests: set
Type: UncategorizedBug


This was (accidentally) fixed in 1.6 by a10f3908042a71ec5ef81bf76f0f278ca5e7a596.
Considering that 1.4 had no support for Python 3, this means that 1.5 is the only version affected by this bug.

If I'm reading our support policy [1] right, 1.5 only receives security fixes at this point (and once 1.7 is realeased, it won't be supported at all anymore) so I'm not sure how to move this ticket forward.

If we do decide to fix this in the 1.5 branch, your proposed patch looks good but it will need a testcase.



comment:3 Changed 4 years ago by Claude Paroz

Resolution: wontfix
Status: newclosed

Considering 1.5 maintenance status, "experimental" Python 3 support in 1.5, and the possibility to workaround that issue, I'm closing the ticket.

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