1
0
mirror of https://github.com/django/django.git synced 2024-12-25 18:46:22 +00:00

Do [8221] in a slightly more clean way.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8222 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2008-08-05 23:53:52 +00:00
parent 9f6ab8104c
commit d06b474251

View File

@ -129,6 +129,7 @@ class Feed(object):
author_email = author_link = None author_email = author_link = None
pubdate = self.__get_dynamic_attr('item_pubdate', item) pubdate = self.__get_dynamic_attr('item_pubdate', item)
if pubdate:
now = datetime.now() now = datetime.now()
utcnow = datetime.utcnow() utcnow = datetime.utcnow()
@ -141,7 +142,6 @@ class Feed(object):
tzDifference = (now - utcnow) tzDifference = (now - utcnow)
# Round the timezone offset to the nearest half hour. # Round the timezone offset to the nearest half hour.
if pubdate:
tzOffsetMinutes = sign * ((tzDifference.seconds / 60 + 15) / 30) * 30 tzOffsetMinutes = sign * ((tzDifference.seconds / 60 + 15) / 30) * 30
tzOffset = timedelta(minutes=tzOffsetMinutes) tzOffset = timedelta(minutes=tzOffsetMinutes)
pubdate = pubdate.replace(tzinfo=FixedOffset(tzOffset)) pubdate = pubdate.replace(tzinfo=FixedOffset(tzOffset))