Changes between Initial Version and Version 2 of Ticket #31459
- Timestamp:
- Apr 14, 2020, 12:14:39 AM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #31459
- Property Has patch set
- Property Owner changed from to
- Property Triage Stage Unreviewed → Accepted
- Property Summary URL path parameter regex too lenient → URL path parameter regex too lenient.
-
Ticket #31459 – Description
initial v2 1 A [ user on the Django forum](https://forum.djangoproject.com/t/noreversematcherror-path-and-args-vs-kwargs/1923)tried to configure a URL like `books/<int:book.id>/`. This was successfully parsed as a URL, but no converters applied.1 A [https://forum.djangoproject.com/t/noreversematcherror-path-and-args-vs-kwargs/1923 user on the Django forum] tried to configure a URL like `books/<int:book.id>/`. This was successfully parsed as a URL, but no converters applied. 2 2 3 3 This is because the left hand side of the regex for finding path parameter syntax looks for converter names with "anything not a colon or >". But the right hand side matches only word characters. … … 5 5 If we matched "anything not a >", then the attempted parameter would have been matched, and "book.id" would have hit the guard we have for invalid identifiers, with a message like: 6 6 7 > "URL route 'books/<int:book.id>/' uses parameter name 'book id' which isn't a valid Python identifier."7 > "URL route 'books/<int:book.id>/' uses parameter name 'book.id' which isn't a valid Python identifier."