Rename BasePage to Page

This commit is contained in:
Florent 2014-09-23 10:50:25 +02:00
commit 444d36eee8
146 changed files with 525 additions and 525 deletions

View file

@ -21,11 +21,11 @@
from weboob.tools.browser.browser import BrowserIncorrectPassword, BrowserBanned, \
BrowserUnavailable, BrowserRetry, \
BrowserHTTPNotFound, BrowserHTTPError, \
BasePage, BaseBrowser, BrokenPageError, \
Page, BaseBrowser, BrokenPageError, \
StandardBrowser, BrowserPasswordExpired, \
BrowserForbidden
__all__ = ['BrowserIncorrectPassword', 'BrowserPasswordExpired', 'BrowserBanned',
'BrowserUnavailable', 'BrowserRetry', 'BrowserHTTPNotFound', 'BrowserHTTPError',
'BasePage', 'BaseBrowser', 'BrokenPageError', 'StandardBrowser', 'BrowserForbidden']
'Page', 'BaseBrowser', 'BrokenPageError', 'StandardBrowser', 'BrowserForbidden']

View file

@ -57,7 +57,7 @@ ControlNotFoundError = ClientForm.ControlNotFoundError
from weboob.tools.parsers import get_parser
__all__ = ['BrowserIncorrectPassword', 'BrowserForbidden', 'BrowserBanned', 'BrowserUnavailable', 'BrowserRetry',
'BrowserPasswordExpired', 'BrowserHTTPNotFound', 'BrowserHTTPError', 'BrokenPageError', 'BasePage',
'BrowserPasswordExpired', 'BrowserHTTPNotFound', 'BrowserHTTPError', 'BrokenPageError', 'Page',
'StandardBrowser', 'BaseBrowser']
@ -89,7 +89,7 @@ class BrokenPageError(Exception):
pass
class BasePage(object):
class Page(object):
"""
Base page
"""
@ -526,7 +526,7 @@ class BaseBrowser(StandardBrowser):
Check the current page.
:param pageCls: class of the page to check
:type pageCls: :class:`BasePage`
:type pageCls: :class:`Page`
:rtype: bool
"""
return isinstance(self.page, pageCls)

View file

@ -18,8 +18,8 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from .browser import BaseBrowser, DomainBrowser, Wget, Firefox, UrlNotAllowed, Profile
from .page import PagesBrowser, BasePage, URL, HTMLPage, LoginBrowser, need_login, JsonPage, LoggedPage, XMLPage
from .page import PagesBrowser, Page, URL, HTMLPage, LoginBrowser, need_login, JsonPage, LoggedPage, XMLPage
__all__ = ['BaseBrowser', 'DomainBrowser', 'Wget', 'Firefox', 'UrlNotAllowed', 'Profile', 'XMLPage',
'PagesBrowser', 'BasePage', 'URL', 'HTMLPage', 'LoginBrowser', 'need_login', 'JsonPage', 'LoggedPage']
'PagesBrowser', 'Page', 'URL', 'HTMLPage', 'LoginBrowser', 'need_login', 'JsonPage', 'LoggedPage']

View file

@ -49,7 +49,7 @@ class URL(object):
"""
A description of an URL on the PagesBrowser website.
It takes one or several regexps to match urls, and an optional BasePage
It takes one or several regexps to match urls, and an optional Page
class which is instancied by PagesBrowser.open if the page matches a regex.
"""
_creation_counter = 0
@ -73,7 +73,7 @@ class URL(object):
If arguments are provided, and only then, they are checked against the arguments
that were used to build the current page URL.
"""
assert self.klass is not None, "You can use this method only if the is a BasePage class handler."
assert self.klass is not None, "You can use this method only if the is a Page class handler."
if len(kwargs):
params = self.match(self.build(**kwargs)).groupdict()
@ -237,15 +237,15 @@ class PagesBrowser(DomainBrowser):
To use it, you have to derive it and to create URL objects as class
attributes. When open() or location() are called, if the url matches
one of URL objects, it returns a BasePage object. In case of location(), it
one of URL objects, it returns a Page object. In case of location(), it
stores it in self.page.
Example:
>>> class HomePage(BasePage):
>>> class HomePage(Page):
... pass
...
>>> class ListPage(BasePage):
>>> class ListPage(Page):
... pass
...
>>> class MyBrowser(PagesBrowser):
@ -405,7 +405,7 @@ def pagination(func):
class NextPage(Exception):
"""
Exception used for example in a BasePage to tell PagesBrowser.pagination to
Exception used for example in a Page to tell PagesBrowser.pagination to
go on the next page.
See :meth:`PagesBrowser.pagination` or decorator :func:`pagination`.
@ -445,7 +445,7 @@ class LoginBrowser(PagesBrowser):
raise NotImplementedError()
class BasePage(object):
class Page(object):
"""
Base page.
"""
@ -561,7 +561,7 @@ class Form(OrderedDict):
return self.page.browser.location(self.request, **kwargs)
class CsvPage(BasePage):
class CsvPage(Page):
DIALECT = 'excel'
FMTPARAMS = {}
ENCODING = 'utf-8'
@ -613,14 +613,14 @@ class CsvPage(BasePage):
return row
class JsonPage(BasePage):
class JsonPage(Page):
def __init__(self, browser, response, *args, **kwargs):
super(JsonPage, self).__init__(browser, response, *args, **kwargs)
from weboob.tools.json import json
self.doc = json.loads(response.text)
class XMLPage(BasePage):
class XMLPage(Page):
ENCODING = None
"""
Force a page encoding.
@ -634,13 +634,13 @@ class XMLPage(BasePage):
self.doc = etree.parse(BytesIO(response.content), parser)
class RawPage(BasePage):
class RawPage(Page):
def __init__(self, browser, response, *args, **kwargs):
super(RawPage, self).__init__(browser, response, *args, **kwargs)
self.doc = response.content
class HTMLPage(BasePage):
class HTMLPage(Page):
"""
HTML page.
"""

View file

@ -23,12 +23,12 @@ import re
from weboob.capabilities.gallery import CapGallery, BaseGallery, BaseImage
from weboob.tools.backend import Module
from weboob.tools.browser import BaseBrowser, BasePage
from weboob.tools.browser import BaseBrowser, Page
__all__ = ['GenericComicReaderModule']
class DisplayPage(BasePage):
class DisplayPage(Page):
def get_page(self, gallery):
src = self.document.xpath(self.browser.params['img_src_xpath'])[0]

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BasePage
from weboob.tools.browser import Page
from weboob.tools.browser import BrokenPageError
from lxml.etree import Comment
@ -90,7 +90,7 @@ class Article(object):
self.date = None
class GenericNewsPage(BasePage):
class GenericNewsPage(Page):
__element_body = NotImplementedError
__article = Article
element_title_selector = NotImplementedError