From 75abe3cf0c6596d6ce068322760a171197a5f152 Mon Sep 17 00:00:00 2001 From: Florent Viard Date: Fri, 25 Sep 2020 12:43:36 +0200 Subject: [PATCH] [docs] Fixes typos in the code of 2 sections of the cookbook --- docs/source/guides/cookbook.rst | 8 ++++---- docs/source/guides/module.rst | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/source/guides/cookbook.rst b/docs/source/guides/cookbook.rst index 85d2cf2bba..13f96176c1 100644 --- a/docs/source/guides/cookbook.rst +++ b/docs/source/guides/cookbook.rst @@ -207,11 +207,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 @@ -275,8 +275,8 @@ When going to next page requires making a ``POST``:: @method class iter_stuff(ListElement): def next_page(self): - if self.doc.get('next_page_params'): - return requests.Request('POST', self.page.url, data=self.doc.get('next_page_params')) + if self.page.doc.get('next_page_params'): + return requests.Request('POST', self.page.url, data=self.page.doc.get('next_page_params')) item_xpath = 'items' diff --git a/docs/source/guides/module.rst b/docs/source/guides/module.rst index 2de832a5c8..9ab5d86ea4 100644 --- a/docs/source/guides/module.rst +++ b/docs/source/guides/module.rst @@ -391,6 +391,7 @@ decorated method. You can either define it yourself, as a class boolean attribute or as a property, or inherit your class from :class:`LoggedPage `. In the latter case, remember that Python inheritance requires the :class:`LoggedPage ` to be placed first such as in:: + from weboob.browser.pages import LoggedPage, HTMLPage class OnlyForLoggedUserPage(LoggedPage, HTMLPage): -- GitLab