:class:`weboob.browser.pages.LoggedPage` just defines ``logged = True`` while other pages define ``logged = False`` by default.
:class:`~weboob.browser.pages.LoggedPage` just defines ``logged = True`` while other pages define ``logged = False`` by default.
To make this attribute variable, use a ``@property`` method returning a ``bool``::
class HomePage(HTMLPage):
...
...
@@ -167,7 +170,7 @@ There are multiple ways to skip elements::
Fix invalid HTML that prevents lxml to be parsed
------------------------------------------------
When the document must be fixed before being parsed, :meth:`weboob.browser.pages.Page.build_doc` can be overridden::
When the document must be fixed before being parsed, :meth:`~weboob.browser.pages.Page.build_doc` can be overridden::
class MyPage(HTMLPage):
def build_doc(self, content):
...
...
@@ -207,11 +210,11 @@ This example code isn't very semantic and could fail silently if columns are cha
obj_id = CleanText('./td[1]')
obj_foo = CleanText('./td[2]')
It can be improved by using the column labels::
It can be improved by using a :class:`~weboob.browser.elements.TableElement` and the column labels::
class MyPage(HTMLPage):
@method
class iter_stuff(ListElement):
class iter_stuff(TableElement):
head_xpath = '//table/tr/th' # where to look for column titles
# these are the column titles from the site
...
...
@@ -231,7 +234,7 @@ Handle multiple tables with similar headers
-------------------------------------------
Sometimes, you might encounter a page with multiple tables to parse. The columns are titled the same, but they aren't at the same column index.
So, it's required to restart :class:`weboob.browser.elements.TableElement` column processing for each table. It's possible to encapsulate elements in other elements::
So, it's required to restart :class:`~weboob.browser.elements.TableElement` column processing for each table. It's possible to encapsulate elements in other elements::
class MultiPage(HTMLPage):
@method
...
...
@@ -275,8 +278,8 @@ When going to next page requires making a ``POST``::
Use the class :class:`TestCase <weboob.tools.test.TestCase>` to derivate it into your new test case. Then, write methods which name starts with ``test_``.
Use the class :class:`~weboob.tools.test.TestCase` to derivate it into your new test case. Then, write methods which name starts with ``test_``.
A test fails when an assertion error is raised. Also, when an other kind of exception is raised, this is an error.
...
...
@@ -46,7 +46,7 @@ You can use ``assert`` to check something, or the base methods ``assertTrue``, `
Backend test
------------
Create a class derivated from :class:`BackendTest <weboob.tools.test.BackendTest>`, and set the ``BACKEND`` class attribute to the name of the backend to test.
Create a class derivated from :class:`~weboob.tools.test.BackendTest`, and set the ``BACKEND`` class attribute to the name of the backend to test.
Then, in your test methods, the ``backend`` attribute will contain the loaded backend. When the class is instancied, it loads every configured backends of the right type, and randomly choose one.