#29146: An example in 'URL dispatcher' document is misleading
-----------------------------------------+------------------------
Reporter: Seohong Park | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 2.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-----------------------------------------+------------------------
An example about the usage of {{{re_path()}}} in 'URL dispatcher' document
https://docs.djangoproject.com/en/2.0/topics/http/urls/ is misleading.
Since {{{re_path()}}} does not insert {{{'$'}}} at the end of URL
parameter (on the contrast, {{{path()}}} inserts {{{'^'}}} and {{{'$'}}}
at the beginning and the end of URL parameter),
{{{re_path('articles/(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/',
views.month_archive)}}} would not be mapped to any URL, because
{{{re_path('articles/(?P<year>[0-9]{4})/', views.year_archive)}}} shades
it.
(i.e. {{{'http://127.0.0.1:8000/articles/2018/12/'}}} invokes
{{{views.year_archive}}}, not {{{views.month_archive}}})
This is misleading, because readers might think {{{re_path}}} also
automatically inserts {{{'^'}}} and {{{'$'}}} to the parameter like
{{{path}}} does.
I think it would be better to insert {{{'$'}}} at the end of each
parameter of {{{re_path()}}} in the document.
Additionally, mentioning about the fact that {{{path()}}} automatically
inserts {{{'^'}}} and {{{'$'}}} to the parameter also would be helpful.
--
Ticket URL: <https://code.djangoproject.com/ticket/29146>
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/052.f93f1f243cdfc7d0b01e69c14c475406%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.