Code

Opened 6 years ago

Closed 5 years ago

Last modified 5 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: 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: UI/UX:

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@…> 6 years ago.
patch solving the problem

Download all attachments as: .zip

Change History (3)

Changed 6 years ago by Ryszard Szopa <ryszard.szopa@…>

patch solving the problem

comment:1 Changed 5 years ago by ramiro

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

duplicate of #7944

comment:2 Changed 5 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.