Changes between Initial Version and Version 2 of Ticket #31459


Ignore:
Timestamp:
Apr 14, 2020, 12:14:39 AM (5 years ago)
Author:
Mariusz Felisiak
Comment:

PR

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #31459

    • Property Has patch set
    • Property Owner changed from nobody to Adam Johnson
    • Property Triage Stage UnreviewedAccepted
    • Property Summary URL path parameter regex too lenientURL 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.
     1A [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.
    22
    33This 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.
     
    55If 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:
    66
    7 > "URL route 'books/<int:book.id>/' uses parameter name 'bookid' 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."
Back to Top