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

@ -20,11 +20,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
from weboob.backend import Backend
from weboob.capabilities.messages import ICapMessages, ICapMessagesReply, Message
from feeds import ArticlesList
class DLFPBackend(Backend, ICapMessages, ICapMessagesReply):
def __init__(self, weboob):
Backend.__init__(self, weboob)
def getNewMessages(self, thread=None):
m = Message('threadid', 'msgid', 'Title', 'Sender', signature='Bite bite bite bite', content='Content content\nContent content.')
return [m]
def iter_messages(self, thread=None):
articles_list = ArticlesList('newspaper')
for id, author, title in articles_list.iter_articles():
yield Message('threadid', id, title, author, signature='Bite bite bite bite', content='Content content\nContent content.')