Code

Opened 6 years ago

Closed 6 years ago

Last modified 3 years ago

#7016 closed (fixed)

Atom Feed dates should use settings.TIME_ZONE

Reported by: mattdw Owned by: ccahoon <chris.cahoon@…>
Component: contrib.syndication Version: master
Severity: Keywords: atom timezone dates
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Atom feeds currently only seem to format dates if the dates have attached timezone information. For some reason my dates don't (perhaps because I'm using SQLite as my backend.)

In settings.py I have: TIME_ZONE = 'Pacific/Auckland'

A comment object has date:

>>> c
<Comment: Matt: A test comment…>
>>> c.published
datetime.datetime(2008, 4, 14, 17, 46, 15, 24810)

the corresponding atom feed entry has date:

<updated>2008-04-14T17:46:15Z</updated>

There are two possible fixes that I can think of; either the correct offset should be calculated (e.g. 2008-04-14T17:46:15+12:00) or the time should be converted to UTC (e.g. 2008-04-15T03:46:15Z.

The rest of my website seems to handle dates and times fine (although I suspect it may be because it's not trying to do any TZ work at all, just displaying the dates as-is), which is why I've categorised it as a Feed Framework issue.

Attachments (4)

atom_rss_feed_dates_fix.diff (5.1 KB) - added by ccahoon <chris.cahoon@…> 6 years ago.
atom_rss_feed_dates_fix.2.diff (4.8 KB) - added by ccahoon <chris.cahoon@…> 6 years ago.
atom_rss_feed_dates_fix.3.diff (4.4 KB) - added by ccahoon <chris.cahoon@…> 6 years ago.
This time for sure.
atom_rss_feed_dates_fix.4.diff (4.5 KB) - added by ccahoon <chris.cahoon@…> 6 years ago.
Nuked an important include fixing a typo, this is the working version

Download all attachments as: .zip

Change History (15)

comment:1 Changed 6 years ago by serialx

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 6 years ago by julianb

I can confirm that the dates in atom feeds are somehow wrong, switched to RSS and everything works.
Should be fixed before 1.0

comment:3 Changed 6 years ago by julianb

  • milestone set to 1.0 beta

comment:4 Changed 6 years ago by chris.cahoon@…

  • Owner changed from nobody to anonymous
  • Status changed from new to assigned

comment:5 Changed 6 years ago by anonymous

  • Owner changed from anonymous to ccahoon
  • Status changed from assigned to new

comment:6 Changed 6 years ago by ccahoon <chris.cahoon@…>

  • Owner changed from ccahoon to anonymous
  • Status changed from new to assigned

comment:7 Changed 6 years ago by ccahoon <chris.cahoon@…>

  • Owner changed from anonymous to ccahoon <chris.cahoon@…>
  • Status changed from assigned to new

comment:8 Changed 6 years ago by ccahoon <chris.cahoon@…>

  • Has patch set

I have verified the specs for both RSS 2.0 and Atom, and the date/time formats are correct now for both of these. It finds the difference between UTC and local time zones and appends that UTC offset correctly to the date/times of the feed entries.

I also had to modify the date formatting methods in utils/feedgenerator.py with custom string formats, because none of the existing ones were quite accurate for the feed specs.

Changed 6 years ago by ccahoon <chris.cahoon@…>

Changed 6 years ago by ccahoon <chris.cahoon@…>

Changed 6 years ago by ccahoon <chris.cahoon@…>

This time for sure.

Changed 6 years ago by ccahoon <chris.cahoon@…>

Nuked an important include fixing a typo, this is the working version

comment:9 Changed 6 years ago by ccahoon <chris.cahoon@…>

  • Triage Stage changed from Accepted to Ready for checkin

Malcolm looked over my shoulder while I was writing this and preparing the patch. He says it's ready for checkin.

comment:10 Changed 6 years ago by jacob

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [8216].

comment:11 Changed 3 years ago by jacob

  • milestone 1.0 beta deleted

Milestone 1.0 beta 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.