diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-08-05 23:52:03 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-08-05 23:52:03 +0000 |
| commit | 9f6ab8104c72d4b8f56ecc8280606cae959ae126 (patch) | |
| tree | b2ba0f7a30c9e3f4a7cce9f082f368ebab660f24 | |
| parent | 1f6d33586c75131fbb31bb5ea619036fd1ae0e37 (diff) | |
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
| -rw-r--r-- | django/contrib/syndication/feeds.py | 7 |
1 files 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})), |
