Opened 19 years ago

Closed 19 years ago

Last modified 18 years ago

#554 closed defect (fixed)

RSS feeds are not valid due to missing timezone in pubdates

Reported by: hugo <gb@…> Owned by: Adrian Holovaty
Component: contrib.syndication Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When the RSS feed includes the pubDate tag and that is taken from a datetime field of a model, the strftime(...) stuff creates a date without timezone - that's because %Z doesn't seem to be implemented with datetime.strftime. Instead of the timezone an emtpy string is returned and so the feed validator doesn't see this feed as valid.

Attachments (1)

feedgenerator_patch.txt (1.5 KB ) - added by ismael@… 19 years ago.
path file

Download all attachments as: .zip

Change History (3)

by ismael@…, 19 years ago

Attachment: feedgenerator_patch.txt added

path file

comment:1 by ismael@…, 19 years ago

To make the date RSS-valid is posible to use module email
email.Utils.formatdate

+    def rfc2822Date( self, date ):        
+        return email.Utils.formatdate( time.mktime( date.timetuple() ) )

         if item['pubdate'] is not None:
+            handler.addQuickElement(u"pubDate", self.rfc2822Date(item['pubdate']), {})

comment:2 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: newclosed

(In [1194]) Completely refactored legacy RSS framework to the new django.contrib.syndication package. Also added Atom support, changed the way feeds are registered and added documentation for the whole lot. This is backwards-incompatible, but the RSS framework had not yet been documented, so this should only affect tinkerers and WorldOnline. Fixes #329, #498, #502 and #554. Thanks for various patches/ideas to alastair, ismael, hugo, eric moritz and garthk

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