This commit is contained in:
Kovid Goyal 2013-11-10 07:30:48 +05:30
parent 91f85b8910
commit a28b690f42

View File

@ -78,7 +78,6 @@ class Article(object):
self._title = clean_ascii_chars(val) self._title = clean_ascii_chars(val)
return property(fget=fget, fset=fset) return property(fget=fget, fset=fset)
def __repr__(self): def __repr__(self):
return \ return \
(u'''\ (u'''\
@ -97,7 +96,7 @@ Has content : %s
return repr(self) return repr(self)
def is_same_as(self, other_article): def is_same_as(self, other_article):
#if self.title != getattr(other_article, 'title', False): # if self.title != getattr(other_article, 'title', False):
# return False # return False
if self.url: if self.url:
return self.url == getattr(other_article, 'url', False) return self.url == getattr(other_article, 'url', False)
@ -137,7 +136,6 @@ class Feed(object):
break break
self.parse_article(item) self.parse_article(item)
def populate_from_preparsed_feed(self, title, articles, oldest_article=7, def populate_from_preparsed_feed(self, title, articles, oldest_article=7,
max_articles_per_feed=100): max_articles_per_feed=100):
self.title = unicode(title if title else _('Unknown feed')) self.title = unicode(title if title else _('Unknown feed'))
@ -176,7 +174,6 @@ class Feed(object):
d = item.get('date', '') d = item.get('date', '')
article.formatted_date = d article.formatted_date = d
def parse_article(self, item): def parse_article(self, item):
self.id_counter += 1 self.id_counter += 1
id = item.get('id', None) id = item.get('id', None)
@ -219,7 +216,8 @@ class Feed(object):
self.articles.append(article) self.articles.append(article)
else: else:
try: try:
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)) 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))
except UnicodeDecodeError: except UnicodeDecodeError:
if not isinstance(title, unicode): if not isinstance(title, unicode):
title = title.decode('utf-8', 'replace') title = title.decode('utf-8', 'replace')
@ -310,7 +308,7 @@ class FeedCollection(list):
self.duplicates = duplicates self.duplicates = duplicates
print len(duplicates) print len(duplicates)
print map(len, self) print map(len, self)
#raise # raise
def find_article(self, article): def find_article(self, article):
for j, f in enumerate(self): for j, f in enumerate(self):