Django

Code

Ticket #7016 (closed: fixed)

Opened 7 months ago

Last modified 4 months ago

Atom Feed dates should use settings.TIME_ZONE

Reported by: mattdw Assigned to: ccahoon <chris.cahoon@gmail.com>
Milestone: 1.0 beta Component: RSS framework
Version: SVN Keywords: atom timezone dates
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

atom_rss_feed_dates_fix.diff (5.1 kB) - added by ccahoon <chris.cahoon@gmail.com> on 08/01/08 15:27:50.
atom_rss_feed_dates_fix.2.diff (4.8 kB) - added by ccahoon <chris.cahoon@gmail.com> on 08/01/08 15:29:15.
atom_rss_feed_dates_fix.3.diff (4.4 kB) - added by ccahoon <chris.cahoon@gmail.com> on 08/01/08 15:30:07.
This time for sure.
atom_rss_feed_dates_fix.4.diff (4.5 kB) - added by ccahoon <chris.cahoon@gmail.com> on 08/01/08 15:32:06.
Nuked an important include fixing a typo, this is the working version

Change History

07/12/08 03:07:48 changed by serialx

  • needs_better_patch changed.
  • stage changed from Unreviewed to Accepted.
  • needs_tests changed.
  • needs_docs changed.

07/20/08 16:55:42 changed 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

07/31/08 13:27:43 changed by julianb

  • milestone set to 1.0 beta.

08/01/08 09:23:38 changed by chris.cahoon@gmail.com

  • owner changed from nobody to anonymous.
  • status changed from new to assigned.

08/01/08 09:24:12 changed by anonymous

  • owner changed from anonymous to ccahoon.
  • status changed from assigned to new.

08/01/08 09:33:53 changed by ccahoon <chris.cahoon@gmail.com>

  • owner changed from ccahoon to anonymous.
  • status changed from new to assigned.

08/01/08 10:33:44 changed by ccahoon <chris.cahoon@gmail.com>

  • owner changed from anonymous to ccahoon <chris.cahoon@gmail.com>.
  • status changed from assigned to new.

08/01/08 15:24:02 changed by ccahoon <chris.cahoon@gmail.com>

  • has_patch set to 1.

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.

08/01/08 15:27:50 changed by ccahoon <chris.cahoon@gmail.com>

  • attachment atom_rss_feed_dates_fix.diff added.

08/01/08 15:29:15 changed by ccahoon <chris.cahoon@gmail.com>

  • attachment atom_rss_feed_dates_fix.2.diff added.

08/01/08 15:30:07 changed by ccahoon <chris.cahoon@gmail.com>

  • attachment atom_rss_feed_dates_fix.3.diff added.

This time for sure.

08/01/08 15:32:06 changed by ccahoon <chris.cahoon@gmail.com>

  • attachment atom_rss_feed_dates_fix.4.diff added.

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

08/01/08 16:22:45 changed by ccahoon <chris.cahoon@gmail.com>

  • 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.

08/05/08 12:43:23 changed by jacob

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in [8216].


Add/Change #7016 (Atom Feed dates should use settings.TIME_ZONE)




Change Properties
Action