#10022 closed (duplicate)
django.views.generic.date_based archive_day and object_detail may get confused by one digit month or day numbers
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Generic views | Version: | master |
Severity: | Keywords: | date_based object_detail | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When object_detail
or archive_day
use month_format="%m"
and one of the or the day month is passed as a one-digit number ('1' for January, '2' for February, etc.), then the view gets confused. It tends to interpret January 13 as November 3 (2009/1/13 ->2009/11/3). The offending line of code is
date = datetime.date(*time.strptime(year+month+day, '%Y'+month_format+day_format)[:3])
The year, month and day are joined together not caring about their boundaries.
The error reported by the Web interface is positively obscure:
No <django.utils.functional.__proxy__ object at [address]> found for
(Yes, for *what* is let as a mistery for the reader.)
Reproduction of this bug may depend on locale settings, such that will produce '1' rather than '01' for January.
Attachments (1)
Change History (3)
Changed 10 years ago by
Attachment: | date_based_one_digit_month_confusion.patch added |
---|
patch solving the problem