use iterators
This commit is contained in:
parent
0ac4885ad8
commit
9cb692a888
5 changed files with 11 additions and 10 deletions
|
|
@ -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.')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue