#24700 closed Cleanup/optimization (fixed)
Some documentation examples incorrectly use \w to match against slugs in URLs
Reported by: | Baptiste Mispelon | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.8 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
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.
Change History (3)
comment:1 by , 10 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
In 269a5db: