Opened 17 years ago

Closed 16 years ago

Last modified 13 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: dev
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: no UI/UX: no

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

Download all attachments as: .zip

Change History (15)

comment:1 by Sung-jin Hong, 16 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Julian Bez, 16 years ago

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

milestone: 1.0 beta

comment:4 by chris.cahoon@…, 16 years ago

Owner: changed from nobody to anonymous
Status: newassigned

comment:5 by anonymous, 16 years ago

Owner: changed from anonymous to ccahoon
Status: assignednew

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

Owner: changed from ccahoon to anonymous
Status: newassigned

comment:7 by ccahoon <chris.cahoon@…>, 16 years ago

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

comment:8 by ccahoon <chris.cahoon@…>, 16 years ago

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.

by ccahoon <chris.cahoon@…>, 16 years ago

by ccahoon <chris.cahoon@…>, 16 years ago

by ccahoon <chris.cahoon@…>, 16 years ago

This time for sure.

by ccahoon <chris.cahoon@…>, 16 years ago

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

comment:9 by ccahoon <chris.cahoon@…>, 16 years ago

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 by Jacob, 16 years ago

Resolution: fixed
Status: newclosed

Fixed in [8216].

comment:11 by Jacob, 13 years ago

milestone: 1.0 beta

Milestone 1.0 beta deleted

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