Commit 8ad9ed9c authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by Romain Bignon

[milleis] Adde fault=NotAvailable to Regexp

Sometimes the HTML tag for caccount_id is somehow absent and we get this crash:

RegexpError: Unable to find 1st -(.*?)- in u''

So I used and "if m:" instead

Closes: 17196@Sibi
parent 730ff77c
...@@ -394,12 +394,13 @@ class CardPage(AbstractAccountPage): ...@@ -394,12 +394,13 @@ class CardPage(AbstractAccountPage):
return False return False
def do_account_attachment(self, accounts): def do_account_attachment(self, accounts):
caccount_aid = Regexp(CleanText('//span[@id="C4__QUE_B160DC66D26AA39615599"]'), r'-(.*?)-')(self.doc) caccount_aid = CleanText('//span[@id="C4__QUE_B160DC66D26AA39615599"]')(self.doc)
m ='-(.*?)-', caccount_aid)
for account in accounts: if m:
if == re.sub(r'\s', '', caccount_aid): regex =
return account for account in accounts:
if == re.sub(r'\s', '', regex):
return account
return NotAvailable return NotAvailable
def has_history(self): def has_history(self):
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