[Django] #29146: An example in 'URL dispatcher' document is misleading

5 views
Skip to first unread message

Django

unread,
Feb 20, 2018, 4:55:05 AM2/20/18
to django-...@googlegroups.com
#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.

Django

unread,
Feb 20, 2018, 5:13:21 AM2/20/18
to django-...@googlegroups.com
#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 | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Seohong Park):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/9710 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/29146#comment:1>

Django

unread,
Feb 20, 2018, 8:08:57 PM2/20/18
to django-...@googlegroups.com
#29146: re_path() examples are missing ^ and $ in regexes
-------------------------------------+-------------------------------------

Reporter: Seohong Park | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* stage: Unreviewed => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/29146#comment:2>

Django

unread,
Feb 20, 2018, 9:31:48 PM2/20/18
to django-...@googlegroups.com
#29146: re_path() examples are missing ^ and $ in regexes
-------------------------------------+-------------------------------------
Reporter: Seohong Park | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: 2.0
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"97168605965143f02c27dac718b6b3e317a4be26" 9716860]:
{{{
#!CommitTicketReference repository=""
revision="97168605965143f02c27dac718b6b3e317a4be26"
Fixed #29146 -- Readded ^ and $ inadvertently removed from re_path()
examples.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29146#comment:3>

Django

unread,
Feb 20, 2018, 9:32:17 PM2/20/18
to django-...@googlegroups.com
#29146: re_path() examples are missing ^ and $ in regexes
-------------------------------------+-------------------------------------
Reporter: Seohong Park | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: 2.0

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"ea0dc5df094c25ff7484353126cba89d1a281889" ea0dc5df]:
{{{
#!CommitTicketReference repository=""
revision="ea0dc5df094c25ff7484353126cba89d1a281889"
[2.0.x] Fixed #29146 -- Readded ^ and $ inadvertently removed from
re_path() examples.

Backport of 97168605965143f02c27dac718b6b3e317a4be26 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29146#comment:4>

Reply all
Reply to author
Forward
0 new messages