[Django] #28627: path-urls documentation implies implicit converter-types

6 views
Skip to first unread message

Django

unread,
Sep 23, 2017, 8:12:53 AM9/23/17
to django-...@googlegroups.com
#28627: path-urls documentation implies implicit converter-types
------------------------------------------------+------------------------
Reporter: Christopher Schäpers | Owner: nobody
Type: Uncategorized | 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: 0
UI/UX: 0 |
------------------------------------------------+------------------------
The documentation for the new path() urls somewhat implies that if you
have a named value in an url without a converter type, but with the name
of a converter-type it takes the name of the value, and uses it as its
converter-type.

E.g.

{{{
path('articles/<slug>/', …)
}}}

would only match a slug, and would pass the value on as "slug".
(As seen here:
https://docs.djangoproject.com/en/dev/topics/http/urls/#example )

This is wrong, as mentioned below (easy to miss, if you're eager to test
stuff out):

{{{
If a converter isn’t included, any string, excluding a / character, is
matched.
}}}

----

However it doesn't help, that the example uses "slug" as a name, and
states

{{{
/articles/2003/03/building-a-django-site/
}}}

would match the last example, even though

{{{
/articles/2003/03/building+a~django@site/
}}}

would match it just as well.

----

Simple fix would be to just change the example from

{{{
articles/<int:year>/<int:month>/<slug>/
}}}

to

{{{
articles/<int:year>/<int:month>/<slug:slug>/
}}}

because I suppose the implicit converter types aren't a feature of 2.0.

(If someone points me to the right repo, I can do the little documentation
change myself)

--
Ticket URL: <https://code.djangoproject.com/ticket/28627>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 23, 2017, 2:22:21 PM9/23/17
to django-...@googlegroups.com
#28627: path-urls documentation implies implicit converter-types
-------------------------------------+-------------------------------------
Reporter: Christopher | Owner: nobody
Schäpers |

Type: Uncategorized | 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: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Christopher Schäpers):

* has_patch: 0 => 1


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

Django

unread,
Sep 25, 2017, 1:06:34 PM9/25/17
to django-...@googlegroups.com
#28627: path-urls documentation implies implicit converter-types
-------------------------------------+-------------------------------------
Reporter: Christopher | Owner: nobody
Schäpers |
Type: Uncategorized | Status: closed
Component: Documentation | Version: 2.0
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

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

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


Comment:

In [changeset:"6da140724dba546d2f3aced1308e617747b0385c" 6da1407]:
{{{
#!CommitTicketReference repository=""
revision="6da140724dba546d2f3aced1308e617747b0385c"
Fixed #28627 -- Added slug converter to some path() examples in docs.
}}}

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

Django

unread,
Sep 25, 2017, 1:11:28 PM9/25/17
to django-...@googlegroups.com
#28627: path-urls documentation implies implicit converter-types
-------------------------------------+-------------------------------------
Reporter: Christopher | Owner: nobody
Schäpers |
Type: Uncategorized | Status: closed
Component: Documentation | Version: 2.0
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

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

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

In [changeset:"ecea60fee884bc41613b8afcb4cca39c8f2fa538" ecea60f]:
{{{
#!CommitTicketReference repository=""
revision="ecea60fee884bc41613b8afcb4cca39c8f2fa538"
[2.0.x] Fixed #28627 -- Added slug converter to some path() examples in
docs.

Backport of 6da140724dba546d2f3aced1308e617747b0385c from master
}}}

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

Reply all
Reply to author
Forward
0 new messages