Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#554 closed defect (fixed)

RSS feeds are not valid due to missing timezone in pubdates

Reported by: hugo <gb@…> Owned by: adrian
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: UI/UX:


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@… 10 years ago.
path file

Download all attachments as: .zip

Change History (3)

Changed 10 years ago by ismael@…

path file

comment:1 Changed 10 years ago by ismael@…

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

+    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 Changed 10 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

(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