#24133: DeleteView success_url = reverse_lazy(...) bug for non ascii urls
--------------------------------------+------------------------------------
     Reporter:  laurentpayot          |      Owner:  nobody
         Type:  Bug                   |     Status:  new
    Component:  Internationalization  |    Version:  1.7
     Severity:  Normal                |   Keywords:  DeleteView
                                      |  reverse_lazy
 Triage Stage:  Unreviewed            |  Has patch:  1
Easy pickings:  0                     |      UI/UX:  0
--------------------------------------+------------------------------------
 When using `DeleteView` mixin `with success_url = reverse_lazy('www:media-
 list')` for a non-ASCII "delete URL" (e.g. // /fr/m**é**dias/2139079220
 /Jules-Verne-cinq-semaines-en-ballon/suppression/ //) I get the following
 error :

 {{{
 Internal Server Error: /fr/médias/2139079220/Jules-Verne-cinq-semaines-en-
 ballon/suppression/
 Traceback (most recent call last):
   File "/opt/VENV/publiberty/lib/python3.4/site-
 packages/django/core/handlers/base.py", line 111, in get_response
     response = wrapped_callback(request, *callback_args,
 **callback_kwargs)
   File "/opt/VENV/publiberty/lib/python3.4/site-
 packages/django/views/generic/base.py", line 69, in view
     return self.dispatch(request, *args, **kwargs)
   File "/opt/VENV/publiberty/lib/python3.4/site-
 packages/django/utils/decorators.py", line 29, in _wrapper
     return bound_func(*args, **kwargs)
   File "/opt/VENV/publiberty/lib/python3.4/site-
 packages/django/contrib/auth/decorators.py", line 22, in _wrapped_view
     return view_func(request, *args, **kwargs)
   File "/opt/VENV/publiberty/lib/python3.4/site-
 packages/django/utils/decorators.py", line 25, in bound_func
     return func.__get__(self, type(self))(*args2, **kwargs2)
   File "/opt/VENV/publiberty/publiberty/django/www/views.py", line 485, in
 dispatch
     return super().dispatch(*args, **kwargs)
   File "/opt/VENV/publiberty/lib/python3.4/site-
 packages/django/views/generic/base.py", line 87, in dispatch
     return handler(request, *args, **kwargs)
   File "/opt/VENV/publiberty/lib/python3.4/site-
 packages/django/views/generic/edit.py", line 259, in post
     return self.delete(request, *args, **kwargs)
   File "/opt/VENV/publiberty/lib/python3.4/site-
 packages/django/views/generic/edit.py", line 253, in delete
     success_url = self.get_success_url()
   File "/opt/VENV/publiberty/lib/python3.4/site-
 packages/django/views/generic/edit.py", line 263, in get_success_url
     return self.success_url % self.object.__dict__
   File "/opt/VENV/publiberty/lib/python3.4/site-
 packages/django/utils/functional.py", line 179, in __mod__
     return six.text_type(self) % rhs
 ValueError: unsupported format character 'C' (0x43) at index 6
 }}}

 For "normal" ascii url no problem at all.
 Following workaround is working:
 {{{
 #!python
     def get_success_url(self):
         return reverse('www:media-list')
 }}}

 Could it be linked to the "accidental" fix of ticket [ticket:22693] ? I'm
 using Python 3.4.2 with Ubuntu 14.10.

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/055.066328784ea24f6e5110e6a52e47236f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to