use iterators

This commit is contained in:
Christophe Benz 2010-03-11 11:37:54 +01:00 committed by Christophe Benz
commit 9cb692a888
5 changed files with 11 additions and 10 deletions

View file

@ -47,7 +47,7 @@ class ArticlesList:
self.section = section
self.articles = []
def fetch(self):
def iter_articles(self):
for section, klass in self.RSS.iteritems():
if self.section and self.section != section:
continue
@ -61,4 +61,4 @@ class ArticlesList:
continue
_id = m.group(1)
article = klass(_id, item['link'], item['title'], item['author'], item['date_parsed'])
print _id, item['author'], item['title']
yield _id, item['author'], item['title']