[Django] #26217: Docs for WeekArchiveView are misleading about %W

14 views
Skip to first unread message

Django

unread,
Feb 13, 2016, 4:27:27 PM2/13/16
to django-...@googlegroups.com
#26217: Docs for WeekArchiveView are misleading about %W
-------------------------------+--------------------
Reporter: koniiiik | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
The [[https://docs.djangoproject.com/en/1.9/ref/class-based-views/generic-
date-based/#weekarchiveview|docs]] state:

> The `'%W'` format uses the ISO week format and its week begins on a
Monday. The `'%W'` format is the same in both the `strftime()` and the
`date`.

However, as established in #7380, this is not true (another example is the
week starting on 2015-11-16, which is week 47 according to `date`, but 46
according to `strftime()`). This section of the docs should be rephrased
into a warning that `'%W'` and `'W'` are not compatible with each other.

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

Django

unread,
Feb 15, 2016, 12:32:11 PM2/15/16
to django-...@googlegroups.com
#26217: Docs for WeekArchiveView are misleading about %W
-------------------------------+------------------------------------
Reporter: koniiiik | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by timgraham):

* needs_docs: => 0
* needs_better_patch: => 0
* type: Uncategorized => Bug
* needs_tests: => 0
* stage: Unreviewed => Accepted


Comment:

Would be great if you could submit a patch since you apparently understand
the issue.

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

Django

unread,
Feb 16, 2016, 4:04:03 AM2/16/16
to django-...@googlegroups.com
#26217: Docs for WeekArchiveView are misleading about %W
-------------------------------+------------------------------------
Reporter: koniiiik | Owner: koniiiik
Type: Bug | Status: assigned
Component: Documentation | Version: 1.9

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by koniiiik):

* owner: nobody => koniiiik
* status: new => assigned


Comment:

I'll try to submit a PR later this week, unless somebody beats me to it.

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

Django

unread,
Feb 20, 2016, 12:30:25 PM2/20/16
to django-...@googlegroups.com
#26217: Docs for WeekArchiveView are misleading about %W
-------------------------------+------------------------------------
Reporter: koniiiik | Owner: koniiiik
Type: Bug | Status: assigned
Component: Documentation | Version: 1.9

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by koniiiik):

As promised, https://github.com/django/django/pull/6171.

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

Django

unread,
Feb 22, 2016, 8:24:54 AM2/22/16
to django-...@googlegroups.com
#26217: Docs for WeekArchiveView are misleading about %W
-------------------------------+------------------------------------
Reporter: koniiiik | Owner: koniiiik
Type: Bug | Status: assigned
Component: Documentation | Version: 1.9

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by timgraham):

* has_patch: 0 => 1


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

Django

unread,
Feb 24, 2016, 2:30:51 PM2/24/16
to django-...@googlegroups.com
#26217: Docs for WeekArchiveView are misleading about %W
-------------------------------+------------------------------------
Reporter: koniiiik | Owner: koniiiik
Type: Bug | Status: assigned
Component: Documentation | Version: 1.9

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by timgraham):

* needs_better_patch: 0 => 1


Comment:

Left some comments for improvement, please uncheck "Patch needs
improvement" when updating.

--
Ticket URL: <https://code.djangoproject.com/ticket/26217#comment:5>

Django

unread,
Feb 28, 2016, 6:26:12 AM2/28/16
to django-...@googlegroups.com
#26217: Docs for WeekArchiveView are misleading about %W
-------------------------------+------------------------------------
Reporter: koniiiik | Owner: koniiiik
Type: Bug | Status: assigned
Component: Documentation | Version: 1.9

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

Comment (by koniiiik):

Thanks for the feedback; I'm trying to incorporate it into the patch.

One interesting thing I found is that the GNU libc supports an additional
format string, `'%V'`, which uses the same ISO 8601 numbering as the `'W'`
format character of the `date` template filter.
(http://linux.die.net/man/3/strftime) However, it is not documented in the
Python docs for `strftime`, since the Python docs are limited to the C89
standard. On the other hand, `'%V'` was introduced in C99, which hopefully
means that any reasonably recent system supports this format string.

Anyway, I think it might be worth adding support for `'%V'` in
`WeekArchiveView`. That way we get a combination of out-of-the-box date
formatters and parsers that work in templates and Python code alike. A
potential pitfall is that requires a different year in certain corner
cases with first and last weeks in a given year, which is `'%G'` for
`strftime` and `'o'` for `date`. This means a bit of special-casing would
be required in `WeekArchiveView`, and clear docs pointing out the
difference, but I still think it's worth it.

Is it okay to implement this in the current PR, or should I open a new
one?

--
Ticket URL: <https://code.djangoproject.com/ticket/26217#comment:6>

Django

unread,
Feb 28, 2016, 6:43:13 AM2/28/16
to django-...@googlegroups.com
#26217: Docs for WeekArchiveView are misleading about %W
-------------------------------+------------------------------------
Reporter: koniiiik | Owner: koniiiik
Type: Bug | Status: assigned
Component: Documentation | Version: 1.9

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by koniiiik):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/26217#comment:7>

Django

unread,
Mar 1, 2016, 10:35:00 AM3/1/16
to django-...@googlegroups.com
#26217: Docs for WeekArchiveView are misleading about %W
-------------------------------+------------------------------------
Reporter: koniiiik | Owner: koniiiik
Type: Bug | Status: closed
Component: Documentation | Version: 1.9
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
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: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"468c6a3b6348fc3701ac569eeb119ddd146cf7c6" 468c6a3b]:
{{{
#!CommitTicketReference repository=""
revision="468c6a3b6348fc3701ac569eeb119ddd146cf7c6"
[1.9.x] Fixed #26217 -- Added a warning about format strings to
WeekArchiveView docs.

Backport of fe8ea3ba3ba709b3d6c39da046f0883a296e6441 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26217#comment:8>

Django

unread,
Mar 1, 2016, 10:35:07 AM3/1/16
to django-...@googlegroups.com
#26217: Docs for WeekArchiveView are misleading about %W
-------------------------------+------------------------------------
Reporter: koniiiik | Owner: koniiiik
Type: Bug | Status: closed
Component: Documentation | Version: 1.9

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
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:"fe8ea3ba3ba709b3d6c39da046f0883a296e6441" fe8ea3ba]:
{{{
#!CommitTicketReference repository=""
revision="fe8ea3ba3ba709b3d6c39da046f0883a296e6441"


Fixed #26217 -- Added a warning about format strings to WeekArchiveView
docs.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26217#comment:9>

Django

unread,
Mar 5, 2016, 7:08:31 PM3/5/16
to django-...@googlegroups.com
#26217: Docs for WeekArchiveView are misleading about %W
-------------------------------+------------------------------------
Reporter: koniiiik | Owner: koniiiik
Type: Bug | Status: closed
Component: Documentation | Version: 1.9

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by koniiiik):

For the sake of completeness, in case someone stumbles upon this ticket,
using `'%V'` as the format string to parse the week number is a dead end,
because while `strftime` is a function specified in the C standard,
`strptime` is not, which means CPython needs to include its own
implementation of `strptime`, and that only implements the set of
`strftime` format strings mandated by C89.

--
Ticket URL: <https://code.djangoproject.com/ticket/26217#comment:10>

Django

unread,
Mar 5, 2016, 7:40:54 PM3/5/16
to django-...@googlegroups.com
#26217: Docs for WeekArchiveView are misleading about %W
-------------------------------+------------------------------------
Reporter: koniiiik | Owner: koniiiik
Type: Bug | Status: closed
Component: Documentation | Version: 1.9

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
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:"2109975e901440da70e29d0f330a600bc2d37e9a" 2109975]:
{{{
#!CommitTicketReference repository=""
revision="2109975e901440da70e29d0f330a600bc2d37e9a"
Refs #26217 -- Fixed typo in docs/ref/class-based-views/generic-date-
based.txt.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26217#comment:11>

Django

unread,
Mar 5, 2016, 7:41:11 PM3/5/16
to django-...@googlegroups.com
#26217: Docs for WeekArchiveView are misleading about %W
-------------------------------+------------------------------------
Reporter: koniiiik | Owner: koniiiik
Type: Bug | Status: closed
Component: Documentation | Version: 1.9

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
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:"d38da1cc401f61ff06aeda31e2b1b1f3be242efd" d38da1cc]:
{{{
#!CommitTicketReference repository=""
revision="d38da1cc401f61ff06aeda31e2b1b1f3be242efd"
[1.9.x] Refs #26217 -- Fixed typo in docs/ref/class-based-views/generic-
date-based.txt.

Backport of 2109975e901440da70e29d0f330a600bc2d37e9a from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26217#comment:12>

Reply all
Reply to author
Forward
0 new messages