mirror of
https://github.com/django/django.git
synced 2024-12-26 11:06:07 +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:
parent
9f6ab8104c
commit
d06b474251
@ -129,19 +129,19 @@ 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)
|
||||||
now = datetime.now()
|
|
||||||
utcnow = datetime.utcnow()
|
|
||||||
|
|
||||||
# Must always subtract smaller time from larger time here.
|
|
||||||
if utcnow > now:
|
|
||||||
sign = -1
|
|
||||||
tzDifference = (utcnow - now)
|
|
||||||
else:
|
|
||||||
sign = 1
|
|
||||||
tzDifference = (now - utcnow)
|
|
||||||
|
|
||||||
# Round the timezone offset to the nearest half hour.
|
|
||||||
if pubdate:
|
if pubdate:
|
||||||
|
now = datetime.now()
|
||||||
|
utcnow = datetime.utcnow()
|
||||||
|
|
||||||
|
# Must always subtract smaller time from larger time here.
|
||||||
|
if utcnow > now:
|
||||||
|
sign = -1
|
||||||
|
tzDifference = (utcnow - now)
|
||||||
|
else:
|
||||||
|
sign = 1
|
||||||
|
tzDifference = (now - utcnow)
|
||||||
|
|
||||||
|
# Round the timezone offset to the nearest half hour.
|
||||||
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))
|
||||||
|
Loading…
Reference in New Issue
Block a user