no API break
This commit is contained in:
parent
9cb692a888
commit
e4846ff2a4
4 changed files with 13 additions and 4 deletions
|
|
@ -25,5 +25,5 @@ class AuMBackend(Backend, ICapMessages, ICapMessagesReply):
|
|||
def __init__(self, weboob):
|
||||
Backend.__init__(self, weboob)
|
||||
|
||||
def iter_messages(self, thread=None):
|
||||
def iterNewMessages(self, thread=None):
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class DLFPBackend(Backend, ICapMessages, ICapMessagesReply):
|
|||
def __init__(self, weboob):
|
||||
Backend.__init__(self, weboob)
|
||||
|
||||
def iter_messages(self, thread=None):
|
||||
def iterNewMessages(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.')
|
||||
|
|
|
|||
|
|
@ -73,10 +73,19 @@ class Message:
|
|||
return self.new
|
||||
|
||||
class ICapMessages:
|
||||
def iter_messages(self, thread=None):
|
||||
def getNewMessages(self, thread=None):
|
||||
"""
|
||||
Get new messages from last time this function has been called.
|
||||
|
||||
@param thread [str] if given, get new messages for a specific thread.
|
||||
@return [list] a list of Message objects.
|
||||
"""
|
||||
return [m for m in self.iterNewMessages(thread)]
|
||||
|
||||
def iterNewMessages(self, thread=None):
|
||||
"""
|
||||
Iterates on new messages from last time this function has been called.
|
||||
|
||||
@param thread [str] if given, get new messages for a specific thread.
|
||||
@return [list] a list of Message objects.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class Application(BaseApplication):
|
|||
def process(self):
|
||||
backends = self.weboob.getBackends()
|
||||
for name, b in backends.iteritems():
|
||||
for message in b.iter_messages():
|
||||
for message in b.iterNewMessages():
|
||||
self.send_email(name, message)
|
||||
|
||||
def send_email(self, backend_name, mail):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue