Opened 9 years ago

Closed 8 years ago

Last modified 5 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@…> 8 years ago.
atom_rss_feed_dates_fix.2.diff (4.8 KB) - added by ccahoon <chris.cahoon@…> 8 years ago.
atom_rss_feed_dates_fix.3.diff (4.4 KB) - added by ccahoon <chris.cahoon@…> 8 years ago.
This time for sure.
atom_rss_feed_dates_fix.4.diff (4.5 KB) - added by ccahoon <chris.cahoon@…> 8 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 8 years ago by Sung-jin Hong

Triage Stage: UnreviewedAccepted

comment:2 Changed 8 years ago by Julian Bez

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 8 years ago by Julian Bez

milestone: 1.0 beta

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

Owner: changed from nobody to anonymous
Status: newassigned

comment:5 Changed 8 years ago by anonymous

Owner: changed from anonymous to ccahoon
Status: assignednew

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

Owner: changed from ccahoon to anonymous
Status: newassigned

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

Owner: changed from anonymous to ccahoon <chris.cahoon@…>
Status: assignednew

comment:8 Changed 8 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 8 years ago by ccahoon <chris.cahoon@…>

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

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

This time for sure.

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

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

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

Triage Stage: AcceptedReady 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 8 years ago by Jacob

Resolution: fixed
Status: newclosed

Fixed in [8216].

comment:11 Changed 5 years ago by Jacob

milestone: 1.0 beta

Milestone 1.0 beta deleted

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