Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#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: Ryszard Szopa <ryszard.szopa@…> Owned by: nobody
Component: Generic views Version: dev
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)

date_based_one_digit_month_confusion.patch (1.1 KB ) - added by Ryszard Szopa <ryszard.szopa@…> 16 years ago.
patch solving the problem

Download all attachments as: .zip

Change History (3)

by Ryszard Szopa <ryszard.szopa@…>, 16 years ago

patch solving the problem

comment:1 by Ramiro Morales, 16 years ago

Resolution: duplicate
Status: newclosed

duplicate of #7944

comment:2 by (none), 16 years ago

milestone: post-1.0

Milestone post-1.0 deleted

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