iter_unread_messages() doesn't raise any exception when website is unavailable

This commit is contained in:
Romain Bignon 2010-08-31 18:09:11 +02:00
commit 0b3b020798

View file

@ -151,6 +151,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
return thread return thread
def iter_unread_messages(self, thread=None): def iter_unread_messages(self, thread=None):
try:
with self.browser: with self.browser:
contacts = self.browser.get_threads_list() contacts = self.browser.get_threads_list()
for contact in contacts: for contact in contacts:
@ -184,6 +185,9 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
children=[], children=[],
flags=Message.IS_UNREAD) flags=Message.IS_UNREAD)
yield thread.root yield thread.root
except BrowserUnavailable, e:
debug('No messages, browser is unavailable: %s' % e)
pass # don't care about waiting
def set_message_read(self, message): def set_message_read(self, message):
if message.id == self.MAGIC_ID_BASKET: if message.id == self.MAGIC_ID_BASKET:
@ -297,7 +301,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
def fill_contact(self, contact, fields): def fill_contact(self, contact, fields):
if 'profile' in fields: if 'profile' in fields:
contact = self.get_contact(contact) contact = self.get_contact(contact)
if 'photos' in fields and contact.photos: if contact and 'photos' in fields:
for name, photo in contact.photos.iteritems(): for name, photo in contact.photos.iteritems():
with self.browser: with self.browser:
if photo.url: if photo.url: