Account() constructor does not take an id
This commit is contained in:
parent
12a9aa9508
commit
301a600923
1 changed files with 4 additions and 3 deletions
|
|
@ -368,8 +368,8 @@ For example::
|
||||||
class ListPage(LoggedPage, HTMLPage):
|
class ListPage(LoggedPage, HTMLPage):
|
||||||
def get_accounts(self):
|
def get_accounts(self):
|
||||||
for el in self.doc.xpath('//ul[@id="list"]/li'):
|
for el in self.doc.xpath('//ul[@id="list"]/li'):
|
||||||
id = el.attrib['id']
|
account = Account()
|
||||||
account = Account(id)
|
account.id = el.attrib['id']
|
||||||
account.label = el.xpath('./td[@class="name"]').text
|
account.label = el.xpath('./td[@class="name"]').text
|
||||||
account.balance = Decimal(el.xpath('./td[@class="balance"]').text)
|
account.balance = Decimal(el.xpath('./td[@class="balance"]').text)
|
||||||
yield account
|
yield account
|
||||||
|
|
@ -382,7 +382,8 @@ An alternative with ``cssselect``::
|
||||||
def get_accounts(self):
|
def get_accounts(self):
|
||||||
for el in self.document.getroot().cssselect('ul#list li'):
|
for el in self.document.getroot().cssselect('ul#list li'):
|
||||||
id = el.attrib['id']
|
id = el.attrib['id']
|
||||||
account = Account(id)
|
account = Account()
|
||||||
|
account.id = el.attrib['id']
|
||||||
account.label = el.cssselect('td.name').text
|
account.label = el.cssselect('td.name').text
|
||||||
account.balance = Decimal(el.cssselect('td.balance').text)
|
account.balance = Decimal(el.cssselect('td.balance').text)
|
||||||
yield account
|
yield account
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue