[Django] #22693: DeleteView.success_url set to reverse_lazy URL raises AttributeError when using Python 3.2

22 views
Skip to first unread message

Django

unread,
May 24, 2014, 7:59:18 PM5/24/14
to django-...@googlegroups.com
#22693: DeleteView.success_url set to reverse_lazy URL raises AttributeError when
using Python 3.2
-------------------------------+--------------------
Reporter: kelvinwong_ca | Owner: nobody
Type: Uncategorized | Status: new
Component: Python 3 | Version: 1.5
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
The Django 1.5 docs recommend that reverse_lazy be used with the
success_url when using DeleteView:

[https://docs.djangoproject.com/en/1.5/ref/class-based-views/generic-
editing/#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::


{{{
# views.py

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.

https://github.com/kelvinwong-
ca/django/commit/42f5b7e0275659b4a2400a4a9c79beb7f26c0d42

The trace produced is on Pastebin

http://pastebin.com/1Uj8yTva

--
Ticket URL: <https://code.djangoproject.com/ticket/22693>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 24, 2014, 9:23:58 PM5/24/14
to django-...@googlegroups.com
#22693: DeleteView.success_url set to reverse_lazy URL raises AttributeError when
using Python 3.2
-------------------------------+--------------------------------------

Reporter: kelvinwong_ca | Owner: nobody
Type: Uncategorized | Status: new
Component: Python 3 | Version: 1.5
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by kelvinwong_ca):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

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.

https://github.com/kelvinwong-
ca/django/commit/38b13a314491eb3e27ae13afd853b8f74f277c03

--
Ticket URL: <https://code.djangoproject.com/ticket/22693#comment:1>

Django

unread,
May 25, 2014, 3:45:33 AM5/25/14
to django-...@googlegroups.com
#22693: DeleteView.success_url set to reverse_lazy URL raises AttributeError when
using Python 3.2
-------------------------------+--------------------------------------
Reporter: kelvinwong_ca | Owner: nobody
Type: Bug | Status: new

Component: Python 3 | Version: 1.5
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by bmispelon):

* has_patch: 0 => 1
* type: Uncategorized => Bug
* needs_tests: 0 => 1


Comment:

Hi,

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.

Thanks.


[1] https://docs.djangoproject.com/en/dev/internals/release-process
/#supported-versions

--
Ticket URL: <https://code.djangoproject.com/ticket/22693#comment:2>

Django

unread,
May 26, 2014, 2:57:09 AM5/26/14
to django-...@googlegroups.com
#22693: DeleteView.success_url set to reverse_lazy URL raises AttributeError when
using Python 3.2
-------------------------------+--------------------------------------
Reporter: kelvinwong_ca | Owner: nobody
Type: Bug | Status: closed

Component: Python 3 | Version: 1.5
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed

Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by claudep):

* status: new => closed
* resolution: => wontfix


Comment:

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

--
Ticket URL: <https://code.djangoproject.com/ticket/22693#comment:3>

Reply all
Reply to author
Forward
0 new messages