Use yield to return objects an not a list
This commit is contained in:
parent
2d4635b3e6
commit
d095811799
1 changed files with 5 additions and 5 deletions
|
|
@ -40,7 +40,9 @@ class Transaction(FrenchTransaction):
|
|||
|
||||
class AccountHistory(BasePage):
|
||||
def on_loaded(self):
|
||||
self.transactions = []
|
||||
pass
|
||||
|
||||
def get_transactions(self):
|
||||
table = self.document.findall('//tbody')[0]
|
||||
i = 1
|
||||
for tr in table.xpath('tr'):
|
||||
|
|
@ -53,9 +55,7 @@ class AccountHistory(BasePage):
|
|||
op.category = texte[4]
|
||||
|
||||
op.amount = Decimal(op.clean_amount(texte[5]))
|
||||
|
||||
self.transactions.append(op)
|
||||
print "coin"
|
||||
i += 1
|
||||
yield op
|
||||
|
||||
def get_transactions(self):
|
||||
return self.transactions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue