Commit 42475507 authored by Martin Sicot's avatar Martin Sicot Committed by Romain Bignon

[cragr] Fix crash due to missing balance

On this quality website the balance of one life insurance was missing
and was not retrievable in any way on the website itself. It caused a
crash because we expected to land on the BGPIPage. We now do not try to
retrieve missing balance if we are not already on a BGPIPage.

closes: 8688@zendesk
closes: 8846@zendesk
closes: 8359@zendesk
closes: 30787@sibi
parent 8449be91
......@@ -28,7 +28,7 @@ from import (
Account, AddRecipientStep, AddRecipientBankError, RecipientInvalidLabel,
Recipient, AccountNotFound,
from weboob.capabilities.base import NotLoaded, find_object, empty
from weboob.capabilities.base import find_object, empty
from weboob.capabilities.profile import ProfileMissing
from weboob.browser import LoginBrowser, URL, need_login, StatesMixin
from weboob.browser.pages import FormNotFound
......@@ -269,7 +269,7 @@ class Cragr(LoginBrowser, StatesMixin):
if ( and not or self.current_perimeter != perimeter:
for account in self.get_list():
if not account in l:
if account not in l:
l = self.get_list()
......@@ -380,7 +380,7 @@ class Cragr(LoginBrowser, StatesMixin):
# update life insurances with unavailable balance
for account in accounts_list:
if account.type == Account.TYPE_LIFE_INSURANCE and not account.balance:
if account.type == Account.TYPE_LIFE_INSURANCE and not account.balance and self.bgpi.is_here():
if account._perimeter != self.current_perimeter:
new_location = self.moveto_insurance_website(account)
......@@ -388,7 +388,7 @@ class Cragr(LoginBrowser, StatesMixin):
account.label, account.balance =
# be sure that we send accounts with balance
return [acc for acc in accounts_list if acc.balance is not NotLoaded]
return [acc for acc in accounts_list if not empty(acc.balance)]
def market_accounts_matching(self, accounts_list, market_accounts_list):
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