News download: Fix bug that could break some downloads in non ASCII locales

This commit is contained in:
Kovid Goyal 2010-09-13 10:15:35 -06:00
parent 80c976e0f2
commit de6aadee76
2 changed files with 6 additions and 4 deletions

View File

@ -35,7 +35,7 @@ class XkcdCom(BasicNewsRecipe):
'date': item['title'],
'timestamp': time.mktime(time.strptime(item['title'], '%Y-%m-%d'))+1,
'url': 'http://xkcd.com' + item['href'],
'title': self.tag_to_string(item).encode('UTF-8'),
'title': self.tag_to_string(item),
'description': '',
'content': '',
})

View File

@ -165,7 +165,9 @@ class Feed(object):
if delta.days*24*3600 + delta.seconds <= 24*3600*self.oldest_article:
self.articles.append(article)
else:
self.logger.debug('Skipping article %s (%s) from feed %s as it is too old.'%(title, article.localtime.strftime('%a, %d %b, %Y %H:%M'), self.title))
t = strftime(u'%a, %d %b, %Y %H:%M', article.localtime.timetuple())
self.logger.debug('Skipping article %s (%s) from feed %s as it is too old.'%
(title, t, self.title))
d = item.get('date', '')
article.formatted_date = d