Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Do [8221] in a slightly more clean way.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8222 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit d06b474251c979c512a966a7fb41cd8a06487c14 1 parent 9f6ab81
@jacobian jacobian authored
Showing with 12 additions and 12 deletions.
  1. +12 −12 django/contrib/syndication/feeds.py
View
24 django/contrib/syndication/feeds.py
@@ -129,19 +129,19 @@ def get_feed(self, url=None):
author_email = author_link = None
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:
+ 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
tzOffset = timedelta(minutes=tzOffsetMinutes)
pubdate = pubdate.replace(tzinfo=FixedOffset(tzOffset))
Please sign in to comment.
Something went wrong with that request. Please try again.