Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#16109 closed Bug (fixed)

Inconsistency in docs: Leading zero of numbers in URLconf

Reported by: wegener92@… Owned by: nobody
Component: Documentation Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In https://docs.djangoproject.com/en/1.3/topics/http/urls/#example, the suggested regex for an article / numbers in a url is

r'^articles/(\d{4})/(\d{2})/(\d+)/$'

But in https://docs.djangoproject.com/en/1.3/ref/models/instances/#django.db.models.permalink, it says

r'/archive/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/$'

In particular, the first expression allows only 05 for a month, the second 05 and 5, which leads to multiple urls for the same content. Additionally, the example get_absolute_url method wouldn't match the first expression (\d{2}) for dates with month or day below 10.

I first thought this is a "support issue", not a bug, so you may want to read my post on stackoverflow.com. It was recommended to me to submit bug report because of this inconsistency in the docs.

Attachments (1)

16109.diff (3.0 KB ) - added by Maura Chace 13 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 by Aymeric Augustin, 13 years ago

Triage Stage: UnreviewedAccepted

Rather minor, but why not.

comment:2 by Julien Phalip, 13 years ago

Type: UncategorizedBug
UI/UX: unset

by Maura Chace, 13 years ago

Attachment: 16109.diff added

comment:3 by Maura Chace, 13 years ago

Has patch: set

Patched the docs to not have any ambiguous date urls (so no d{1,2}).

comment:4 by Adam Nelson, 13 years ago

Triage Stage: AcceptedReady for checkin

patch applies cleanly and text makes sense

comment:5 by James Bennett, 13 years ago

Resolution: fixed
Status: newclosed

In [16811]:

Fixed #16109: Corrected an inconsistency in URLconf examples for matching a numeric month.

comment:6 by James Bennett, 13 years ago

In [16812]:

[1.3.X] Fixed #16109: Corrected an inconsistency in URLconf examples for matching a numeric month. Backport of [16811] from trunk.

Note: See TracTickets for help on using tickets.
Back to Top