From 57812cdcd3c35bf36b3c04b567c07b8a9fa0e7c8 Mon Sep 17 00:00:00 2001 From: Florian Duguet Date: Thu, 31 Jan 2019 16:05:29 +0100 Subject: [PATCH] [barclays] avoid crash in go_to_account if _btn is None This can happen for loan Closes: 35187@sibi 35596@sibi 35597@sibi --- modules/barclays/browser.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/barclays/browser.py b/modules/barclays/browser.py index aee4a5c8cc..b42fc0244b 100644 --- a/modules/barclays/browser.py +++ b/modules/barclays/browser.py @@ -133,6 +133,11 @@ def iter_accounts(self): traccounts = [] for account in accounts: + if account._btn is None: + # we can't access to account details without this button + traccounts.append(account) + continue + if account.type == Account.TYPE_CHECKING: # Only checking accounts have an IBAN self._go_to_account(account) @@ -181,6 +186,8 @@ def iter_history(self, account): return [] elif account.type in (Account.TYPE_LOAN, Account.TYPE_REVOLVING_CREDIT): return [] + if account._btn is None: + return [] self._go_to_account(account) @@ -222,6 +229,8 @@ def iter_history(self, account): def iter_coming(self, account): if account.type != Account.TYPE_CARD: raise NotImplementedError() + if account._btn is None: + return [] self._go_to_account(account) return self.page.iter_history() @@ -230,6 +239,8 @@ def iter_coming(self, account): def iter_investments(self, account): if account.type not in (Account.TYPE_LIFE_INSURANCE, Account.TYPE_MARKET): raise NotImplementedError() + if account._btn is None: + return [] self._go_to_account(account) -- GitLab