From 9f6ab8104c72d4b8f56ecc8280606cae959ae126 Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Tue, 5 Aug 2008 23:52:03 +0000 Subject: [PATCH] Fixed #8128: correctly handle feeds that incorrectly don't provide pubdates. Be liberal in what you accept! git-svn-id: http://code.djangoproject.com/svn/django/trunk@8221 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/syndication/feeds.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/django/contrib/syndication/feeds.py b/django/contrib/syndication/feeds.py index a802171800..933361d233 100644 --- a/django/contrib/syndication/feeds.py +++ b/django/contrib/syndication/feeds.py @@ -141,9 +141,10 @@ class Feed(object): tzDifference = (now - utcnow) # Round the timezone offset to the nearest half hour. - tzOffsetMinutes = sign * ((tzDifference.seconds / 60 + 15) / 30) * 30 - tzOffset = timedelta(minutes=tzOffsetMinutes) - pubdate = pubdate.replace(tzinfo=FixedOffset(tzOffset)) + if pubdate: + tzOffsetMinutes = sign * ((tzDifference.seconds / 60 + 15) / 30) * 30 + tzOffset = timedelta(minutes=tzOffsetMinutes) + pubdate = pubdate.replace(tzinfo=FixedOffset(tzOffset)) feed.add_item( title = title_tmp.render(RequestContext(self.request, {'obj': item, 'site': current_site})),