From d319625288643decc272bc1a0d4976185165f1af Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Tue, 13 Jul 2010 18:41:22 +0200 Subject: [PATCH] display a notice in the status when the account is waiting --- weboob/applications/qhavesex/status.py | 4 ++-- weboob/backends/aum/backend.py | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/weboob/applications/qhavesex/status.py b/weboob/applications/qhavesex/status.py index 3fe0013a..6af4ed42 100644 --- a/weboob/applications/qhavesex/status.py +++ b/weboob/applications/qhavesex/status.py @@ -78,9 +78,9 @@ class Account(QFrame): return if field.flags & StatusField.FIELD_HTML: - value = field.value.replace('&', '&').replace('<', '<').replace('>', '>') - else: value = u'%s' % field.value + else: + value = (u'%s' % field.value).replace('&', '&').replace('<', '<').replace('>', '>') if field.flags & StatusField.FIELD_TEXT: if self.process.in_p: diff --git a/weboob/backends/aum/backend.py b/weboob/backends/aum/backend.py index e6e04295..50651b53 100644 --- a/weboob/backends/aum/backend.py +++ b/weboob/backends/aum/backend.py @@ -60,11 +60,14 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesReply, ICapDating, ICapC def get_status(self): with self.browser: - return ( - StatusField('myname', 'My name', self.browser.get_my_name()), - StatusField('score', 'Score', self.browser.score()), - StatusField('avcharms', 'Available charms', self.browser.nb_available_charms()), - ) + try: + return ( + StatusField('myname', 'My name', self.browser.get_my_name()), + StatusField('score', 'Score', self.browser.score()), + StatusField('avcharms', 'Available charms', self.browser.nb_available_charms()), + ) + except AdopteWait: + return (StatusField('notice', '', u'

You are currently waiting 1am to be able to connect with this account

', StatusField.FIELD_HTML|StatusField.FIELD_TEXT)) def iter_messages(self, thread=None): for message in self._iter_messages(thread, False):