{{{
path('<int:question_id/vote/', views.vote, name='vote'),
}}}
This leads to a frustrating debugging experience, where a 404 or
`NoReverseMatch` could occur and only the eagle-eyed could spot why.
Similar to the `^`/`$` system check added in #28663, I propose a new check
in `RoutePattern.check()` for unmatched `<` or `>`. It's rather unlikely
those characters are legitimately used in URLs.
(Inspired by [https://forum.djangoproject.com/t/noreversematch-at-end-of-
tutorial-4/6513/9 a new user making this mistake] and asking for help on
the forum.)
--
Ticket URL: <https://code.djangoproject.com/ticket/34691>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => Amir Karimi
* status: new => assigned
Comment:
Seems essential. I can work on it by splitting the routes based on '/' and
checking if each part having started with '<' must have ended with '>'.
--
Ticket URL: <https://code.djangoproject.com/ticket/34691#comment:1>
* component: Core (URLs) => Core (System checks)
* stage: Unreviewed => Accepted
Comment:
Sounds reasonable, this should raise a system check warning, not an error.
--
Ticket URL: <https://code.djangoproject.com/ticket/34691#comment:2>
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/17045]
--
Ticket URL: <https://code.djangoproject.com/ticket/34691#comment:3>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/34691#comment:4>
* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/34691#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"d1855c4847215f3afe3708736be13388bb6437eb" d1855c48]:
{{{
#!CommitTicketReference repository=""
revision="d1855c4847215f3afe3708736be13388bb6437eb"
Fixed #34691 -- Added system check for unmatched angle brackets in path().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34691#comment:6>
Comment (by GitHub <noreply@…>):
In [changeset:"e5e9699e0fe1e7affe3c68082ed1e205726a4c79" e5e9699]:
{{{
#!CommitTicketReference repository=""
revision="e5e9699e0fe1e7affe3c68082ed1e205726a4c79"
Refs #34691 -- Optimized system check for unmatched angle brackets in
path().
Follow up to d1855c4847215f3afe3708736be13388bb6437eb.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34691#comment:7>