Skip to content

Commit

Permalink
change module_urltitle.__get_age_str to use the same timezone as publ…
Browse files Browse the repository at this point in the history
…ished
  • Loading branch information
kipe committed Feb 27, 2016
1 parent 6656859 commit f2d4626
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pyfibot/modules/module_urltitle.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"""

from __future__ import unicode_literals, print_function, division
#from __future__ import print_function, division
import fnmatch
import urlparse
import logging
import re
from datetime import datetime
from dateutil.tz import tzutc
import math

from types import TupleType
Expand Down Expand Up @@ -100,7 +100,7 @@ def __get_length_str(secs):


def __get_age_str(published):
now = datetime.now()
now = datetime.now(tz=published.tzinfo)

# Check if the publish date is in the future (upcoming episode)
if published > now:
Expand Down Expand Up @@ -437,7 +437,7 @@ def _handle_tweet(url):
user = tweet['user']['screen_name']
name = tweet['user']['name'].strip()
verified = tweet['user']['verified']

retweets = tweet['retweet_count']
favorites = tweet['favorite_count']
created = tweet['created_at']
Expand Down Expand Up @@ -542,7 +542,7 @@ def _handle_youtube_gdata(url):
else:
agerestricted = ""

## Content age
# Content age
published = entry['snippet']['publishedAt']
published = datetime.strptime(published, "%Y-%m-%dT%H:%M:%S.%fZ")
agestr = __get_age_str(published)
Expand Down Expand Up @@ -699,6 +699,7 @@ def _handle_reddit(url):
# parsing error, use default title
return


def _handle_aamulehti(url):
"""http://www.aamulehti.fi/*"""
bs = __get_bs(url)
Expand Down

0 comments on commit f2d4626

Please sign in to comment.