From b1c829542954d378930da97decdfbcb3260ab9a6 Mon Sep 17 00:00:00 2001 From: Quentin Defenouillere Date: Thu, 4 Jul 2019 10:55:10 +0200 Subject: [PATCH] [cragr/api] Do not fetch main_account iban if None Some connections have no main_account, in which case we should not try to get mina_account iban nor yield it. Closes: 43394@sibi --- modules/cragr/api/browser.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/cragr/api/browser.py b/modules/cragr/api/browser.py index a1d3ae291a..b2c330b19d 100644 --- a/modules/cragr/api/browser.py +++ b/modules/cragr/api/browser.py @@ -255,6 +255,8 @@ def iter_accounts(self): main_account.owner_type = self.page.get_owner_type() main_account._contract = contract + else: + main_account = None space_type = self.page.get_space_type() accounts_list = list(self.page.iter_accounts()) @@ -283,12 +285,13 @@ def iter_accounts(self): account_balances.update(self.page.get_account_balances()) loan_ids.update(self.page.get_loan_ids()) - if main_account.type == Account.TYPE_CHECKING: - main_account.iban = self.get_account_iban(main_account._index, 1, main_account.id) + if main_account: + if main_account.type == Account.TYPE_CHECKING: + main_account.iban = self.get_account_iban(main_account._index, 1, main_account.id) - if main_account.id not in all_accounts: - all_accounts[main_account.id] = main_account - yield main_account + if main_account.id not in all_accounts: + all_accounts[main_account.id] = main_account + yield main_account for account in accounts_list: if empty(account.balance): -- GitLab