diff --git a/modules/dlfp/browser.py b/modules/dlfp/browser.py index 4f896d19ffe1026571a4c8191289ecba3a4a6985..1ac86cef8a9be45a60763e0803f76c3554804d5c 100644 --- a/modules/dlfp/browser.py +++ b/modules/dlfp/browser.py @@ -21,7 +21,7 @@ import urllib import re -from weboob.tools.browser import BaseBrowser, BrowserHTTPNotFound, BrowserHTTPError, BrowserIncorrectPassword +from weboob.tools.browser import BaseBrowser, BrowserHTTPNotFound, BrowserHTTPError, BrowserIncorrectPassword, BrokenPageError from weboob.capabilities.messages import CantSendMessage from .pages.index import IndexPage, LoginPage @@ -34,22 +34,22 @@ class DLFP(BaseBrowser): DOMAIN = 'linuxfr.org' PROTOCOL = 'https' - PAGES = {'https?://.*linuxfr.org/?': IndexPage, - 'https?://.*linuxfr.org/compte/connexion': LoginPage, - 'https?://.*linuxfr.org/news/[^\.]+': ContentPage, - 'https?://.*linuxfr.org/wiki/(?!nouveau)[^/]+': ContentPage, - 'https?://.*linuxfr.org/wiki': WikiEditPage, - 'https?://.*linuxfr.org/wiki/nouveau': WikiEditPage, - 'https?://.*linuxfr.org/wiki/[^\.]+/modifier': WikiEditPage, - 'https?://.*linuxfr.org/suivi/[^\.]+': ContentPage, - 'https?://.*linuxfr.org/sondages/[^\.]+': ContentPage, - 'https?://.*linuxfr.org/users/[^\./]+/journaux/[^\.]+': ContentPage, - 'https?://.*linuxfr.org/forums/[^\./]+/posts/[^\.]+': ContentPage, - 'https?://.*linuxfr.org/nodes/(\d+)/comments/(\d+)': CommentPage, - 'https?://.*linuxfr.org/nodes/(\d+)/comments/nouveau': NewCommentPage, - 'https?://.*linuxfr.org/nodes/(\d+)/comments': NodePage, - 'https?://.*linuxfr.org/nodes/(\d+)/tags/nouveau': NewTagPage, - 'https?://.*linuxfr.org/board/index.xml': BoardIndexPage, + PAGES = {'https?://[^/]*linuxfr\.org/?': IndexPage, + 'https?://[^/]*linuxfr\.org/compte/connexion': LoginPage, + 'https?://[^/]*linuxfr\.org/news/[^\.]+': ContentPage, + 'https?://[^/]*linuxfr\.org/wiki/(?!nouveau)[^/]+': ContentPage, + 'https?://[^/]*linuxfr\.org/wiki': WikiEditPage, + 'https?://[^/]*linuxfr\.org/wiki/nouveau': WikiEditPage, + 'https?://[^/]*linuxfr\.org/wiki/[^\.]+/modifier': WikiEditPage, + 'https?://[^/]*linuxfr\.org/suivi/[^\.]+': ContentPage, + 'https?://[^/]*linuxfr\.org/sondages/[^\.]+': ContentPage, + 'https?://[^/]*linuxfr\.org/users/[^\./]+/journaux/[^\.]+': ContentPage, + 'https?://[^/]*linuxfr\.org/forums/[^\./]+/posts/[^\.]+': ContentPage, + 'https?://[^/]*linuxfr\.org/nodes/(\d+)/comments/(\d+)': CommentPage, + 'https?://[^/]*linuxfr\.org/nodes/(\d+)/comments/nouveau': NewCommentPage, + 'https?://[^/]*linuxfr\.org/nodes/(\d+)/comments': NodePage, + 'https?://[^/]*linuxfr\.org/nodes/(\d+)/tags/nouveau': NewTagPage, + 'https?://[^/]*linuxfr\.org/board/index.xml': BoardIndexPage, } last_board_msg_id = None @@ -145,6 +145,8 @@ def get_content(self, _id): content = self.page.get_comment(int(m.group(1))) else: content = self.page.get_article() + else: + raise BrokenPageError('Not on a content or comment page (%r)' % self.page) if _id is not None: content.id = _id