use exception AdopteBanned instead of BrowserUnavailable

This commit is contained in:
Romain Bignon 2010-11-11 14:30:40 +01:00
commit 26e7604cd4
2 changed files with 6 additions and 4 deletions

View file

@ -18,6 +18,7 @@
import re
from weboob.tools.browser import BasePage, BrowserUnavailable
from weboob.backends.aum.exceptions import AdopteBanned
class PageBase(BasePage):
def __init__(self, *args, **kwargs):
@ -27,12 +28,12 @@ class PageBase(BasePage):
b = self.document.getElementsByTagName('body')[0]
for div in b.getElementsByTagName('div'):
if div.getAttribute('id') == 'oops':
raise BrowserUnavailable()
raise BrowserUnavailable('Oops')
# Check when the account is temporarily blocked.
for img in self.document.getElementsByTagName('img'):
if img.getAttribute('src') == 'http://s.adopteunmec.com/img/exemple.jpg':
raise BrowserUnavailable('Your account is blocked. You have to unblock by yourself but we can\'t help you.')
raise AdopteBanned('Your account is blocked. You have to unblock by yourself but we can\'t help you.')
def open_contact_list_page(self):
self.browser.follow_link(url_regex=r"/mails.php$")

View file

@ -19,7 +19,8 @@
import re
from weboob.tools.mech import ClientForm
from weboob.tools.browser import BrowserIncorrectPassword, BrowserUnavailable
from weboob.tools.browser import BrowserIncorrectPassword
from weboob.backends.aum.exceptions import AdopteBanned
from weboob.capabilities.account import AccountRegisterError
from .base import PageBase
@ -114,7 +115,7 @@ class RedirectPage(PageBase):
class BanPage(PageBase):
def on_loaded(self):
raise BrowserUnavailable('Your IP address is banned.')
raise AdopteBanned('Your IP address is banned.')
class ShopPage(PageBase):
pass