#30600: Django is silence on ValueError in converter to_python() method.
-------------------------------------+-------------------------------------
Reporter: Fraterius | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Core (URLs) | Version: master
Severity: Normal | Resolution: wontfix
Keywords: url pattern | Triage Stage:
converter regexp | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Fraterius):
Like You said great that it should rise ValueError, but there should be
the sentence that You wrote, what will happen if it rises ValueError (at
least). I guaranty that there will be more such devs like me, as it really
is not intuitive. Is it a problem to make it like a note in the docs? 404
as a consequence isn't so obvious for everyone and it's nowhere in the
docs.
Replying to [comment:2 felixxm]:
> Thanks for the report, however this is
[https://docs.djangoproject.com/en/2.2/topics/http/urls/#registering-
custom-path-converters documented],
[https://github.com/django/django/blob/26d16c07fdc4a297daca554afa6375c70d6d82a9/tests/urlpatterns/tests.py#L208-L213
tested], and
[https://github.com/django/django/pull/7482#issuecomment-259520026
expected behavior].
>
> The assumption is that `to_python()` in custom converters will raise
`ValueError` if it cannot convert the given value which means no match and
404 as a consequence.
--
Ticket URL: <https://code.djangoproject.com/ticket/30600#comment:3>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.e217a10137d375e928d08183b121d4db%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.