[Django] #24700: Some documentation examples incorrectly use \w to match against slugs in URLs

12 views
Skip to first unread message

Django

unread,
Apr 24, 2015, 11:01:25 AM4/24/15
to django-...@googlegroups.com
#24700: Some documentation examples incorrectly use \w to match against slugs in
URLs
------------------------------------------------+------------------------
Reporter: bmispelon | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.8
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 |
------------------------------------------------+------------------------
On https://docs.djangoproject.com/en/dev/topics/http/urls/#including-
other-urlconfs (found with `git grep -IF \\w -- docs/`), slugs are matched
using `\w+`, like so:

{{{
url(r'^(?P<page_slug>\w+)-(?P<page_id>\w+)/history/$', views.history),
url(r'^(?P<page_slug>\w+)-(?P<page_id>\w+)/edit/$', views.edit),
url(r'^(?P<page_slug>\w+)-(?P<page_id>\w+)/discuss/$', views.discuss),
url(r'^(?P<page_slug>\w+)-(?P<page_id>\w+)/permissions/$',
views.permissions),
}}}

This is incorrect, since slugs can also contain dashes (`-`) so `[\w-]+`
should be used instead.

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

Django

unread,
Apr 24, 2015, 11:18:16 AM4/24/15
to django-...@googlegroups.com
#24700: Some documentation examples incorrectly use \w to match against slugs in
URLs
--------------------------------------+------------------------------------

Reporter: bmispelon | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* stage: Unreviewed => Accepted


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

Django

unread,
Apr 24, 2015, 1:10:53 PM4/24/15
to django-...@googlegroups.com
#24700: Some documentation examples incorrectly use \w to match against slugs in
URLs
--------------------------------------+------------------------------------
Reporter: bmispelon | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.8
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Marcus Pennington <marcuspen@…>):

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


Comment:

In [changeset:"269a5dbdd37362e27b2bb3bf3a600ffd5ea2c3bb" 269a5db]:
{{{
#!CommitTicketReference repository=""
revision="269a5dbdd37362e27b2bb3bf3a600ffd5ea2c3bb"
Fixed #24700 -- Added dash to slug regex in http docs
}}}

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

Django

unread,
Apr 24, 2015, 1:11:05 PM4/24/15
to django-...@googlegroups.com
#24700: Some documentation examples incorrectly use \w to match against slugs in
URLs
--------------------------------------+------------------------------------
Reporter: bmispelon | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.8

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

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

In [changeset:"2a334d79851944d3ba6752b3486e4274d2150c29" 2a334d79]:
{{{
#!CommitTicketReference repository=""
revision="2a334d79851944d3ba6752b3486e4274d2150c29"
[1.8.x] Fixed #24700 -- Added dash to slug regex in http docs

Backport of 269a5dbdd37362e27b2bb3bf3a600ffd5ea2c3bb from master
}}}

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

Reply all
Reply to author
Forward
0 new messages