#7016 closed (fixed)
Atom Feed dates should use settings.TIME_ZONE
Reported by: | mattdw | Owned by: | |
---|---|---|---|
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)
Change History (15)
comment:1 by , 16 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 16 years ago
comment:3 by , 16 years ago
milestone: | → 1.0 beta |
---|
comment:4 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:5 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | assigned → new |
comment:6 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:7 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | assigned → new |
comment:8 by , 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 , 16 years ago
Attachment: | atom_rss_feed_dates_fix.diff added |
---|
by , 16 years ago
Attachment: | atom_rss_feed_dates_fix.2.diff added |
---|
by , 16 years ago
Attachment: | atom_rss_feed_dates_fix.4.diff added |
---|
Nuked an important include fixing a typo, this is the working version
comment:9 by , 16 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Malcolm looked over my shoulder while I was writing this and preparing the patch. He says it's ready for checkin.
I can confirm that the dates in atom feeds are somehow wrong, switched to RSS and everything works.
Should be fixed before 1.0