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
This commit is contained in:
Jacob Kaplan-Moss 2008-08-05 23:52:03 +00:00
parent 1f6d33586c
commit 9f6ab8104c
1 changed files with 4 additions and 3 deletions

View File

@ -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})),