Commit 084e7808 authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by Romain Bignon

[ing] Added condition to get_isin() method

Some ING connections are crashing because we try to get an element of an
empty xpath:
self.doc.xpath('//div[@id="headFiche"]//span[@id="test3"]/text()')[0].split(' - ')[0].strip()
IndexError: list index out of range
I added an "if isin" condition to rpevent the recurrent bugs also they
are not always reproducible locally.

Closes: 12520@sibi
parent e9d5dcff
......@@ -40,7 +40,8 @@ class Transaction(FrenchTransaction):
class TitreValuePage(LoggedPage, HTMLPage):
def get_isin(self):
return unicode(self.doc.xpath('//div[@id="headFiche"]//span[@id="test3"]/text()')[0].split(' - ')[0].strip())
isin = self.doc.xpath('//div[@id="headFiche"]//span[@id="test3"]/text()')
return unicode(isin[0].split(' - ')[0].strip()) if isin else NotAvailable
class TitrePage(LoggedPage, RawPage):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment