diff --git a/weboob/backends/gazelle/pages/base.py b/weboob/backends/gazelle/pages/base.py
new file mode 100644
index 00000000..1f236fa6
--- /dev/null
+++ b/weboob/backends/gazelle/pages/base.py
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+
+# Copyright(C) 2010-2011 Romain Bignon
+#
+# This file is part of weboob.
+#
+# weboob is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# weboob is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with weboob. If not, see .
+
+
+from weboob.tools.browser import BrowserUnavailable, BasePage as _BasePage
+
+
+__all__ = ['BasePage']
+
+
+class BasePage(_BasePage):
+ def on_loaded(self):
+ errors = []
+ for div in self.parser.select(self.document.getroot(), 'div.poetry'):
+ errors.append(self.parser.tocleanstring(div))
+
+ if len(errors) > 0:
+ raise BrowserUnavailable(', '.join(errors))
diff --git a/weboob/backends/gazelle/pages/index.py b/weboob/backends/gazelle/pages/index.py
index 7eec7063..e59226f8 100644
--- a/weboob/backends/gazelle/pages/index.py
+++ b/weboob/backends/gazelle/pages/index.py
@@ -18,8 +18,8 @@
# along with weboob. If not, see .
-from weboob.tools.browser import BasePage, BrowserIncorrectPassword, BrowserBanned
-from weboob.tools.misc import remove_html_tags
+from weboob.tools.browser import BrowserIncorrectPassword, BrowserBanned
+from .base import BasePage
__all__ = ['IndexPage', 'LoginPage']
@@ -32,9 +32,11 @@ class IndexPage(BasePage):
class LoginPage(BasePage):
def on_loaded(self):
+ BasePage.on_loaded(self)
+
warns = self.parser.select(self.document.getroot(), 'span.warning')
for warn in warns:
- text = remove_html_tags(self.parser.tostring(warn)).strip()
+ text = self.parser.tocleanstring(warn)
if text.startswith('Your username'):
raise BrowserIncorrectPassword(text)
if text.startswith('You are banned'):
diff --git a/weboob/backends/gazelle/pages/torrents.py b/weboob/backends/gazelle/pages/torrents.py
index 4c79a415..329b5c6d 100644
--- a/weboob/backends/gazelle/pages/torrents.py
+++ b/weboob/backends/gazelle/pages/torrents.py
@@ -23,10 +23,11 @@ import urlparse
from logging import warning, debug
from weboob.tools.misc import html2text, get_bytes_size
-from weboob.tools.browser import BasePage
from weboob.capabilities.torrent import Torrent
from weboob.capabilities.base import NotLoaded
+from .base import BasePage
+
__all__ = ['TorrentsPage']