definitively fix the fucking infinite loop

This commit is contained in:
Romain Bignon 2013-02-25 23:32:13 +01:00
commit a5f32bbd1b

View file

@ -120,17 +120,20 @@ class Ing(BaseBrowser):
self.location(self.accountspage, urllib.urlencode(data)) self.location(self.accountspage, urllib.urlencode(data))
self.where = "history" self.where = "history"
jid = self.page.get_history_jid() jid = self.page.get_history_jid()
i = 0 # index, we get always the same page, but with more informations index = 0 # index, we get always the same page, but with more informations
while 1: while 1:
hashlist = [] hashlist = []
for transaction in self.page.get_transactions(i): i = index
for transaction in self.page.get_transactions(index):
while transaction.id in hashlist: while transaction.id in hashlist:
transaction.id = hashlib.md5(transaction.id + "1").hexdigest() transaction.id = hashlib.md5(transaction.id + "1").hexdigest()
hashlist.append(transaction.id) hashlist.append(transaction.id)
i += 1 i += 1
yield transaction yield transaction
if self.page.islast(): # if there is no more transactions, it is useless to continue
if i == index or self.page.islast():
return return
index = i
data = {"AJAX:EVENTS_COUNT": 1, data = {"AJAX:EVENTS_COUNT": 1,
"AJAXREQUEST": "_viewRoot", "AJAXREQUEST": "_viewRoot",
"autoScroll": "", "autoScroll": "",