Opened 10 years ago
Last modified 9 years ago
#24133 closed Bug
DeleteView success_url = reverse_lazy(...) bug for non ascii urls — at Initial Version
Reported by: | Laurent Payot | Owned by: | nobody |
---|---|---|---|
Component: | Generic views | Version: | 1.7 |
Severity: | Normal | Keywords: | DeleteView |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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:
def get_success_url(self): return reverse('www:media-list')
Could it be linked to the "accidental" fix of ticket 22693 ? I'm using Python 3.4.2 with Ubuntu 14.10.
Note:
See TracTickets
for help on using tickets.