Commit 56876f8f authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by ntome

[lcl] Corrected condition for life insurances

The Lower() crashed when one of the Dict() values was null in the JSON.
We first verify if these values exist before calling .lower() on the
strings.

Closes: 11354@zendesk, 11432@zendesk
parent ef1f8e24
......@@ -42,7 +42,7 @@ from weboob.browser.pages import LoggedPage, HTMLPage, JsonPage, FormNotFound, p
from weboob.browser.filters.html import Attr, Link, TableCell, AttributeNotFound
from weboob.browser.filters.standard import (
CleanText, Field, Regexp, Format, Date, CleanDecimal, Map, AsyncLoad, Async, Env, Slugify,
BrowserURL, Eval, Lower, Currency,
BrowserURL, Eval, Currency,
)
from weboob.browser.filters.json import Dict
from weboob.exceptions import BrowserUnavailable, BrowserIncorrectPassword
......@@ -963,9 +963,14 @@ class AVListPage(LoggedPage, JsonPage):
class item(ItemElement):
def condition(self):
return (
Lower(Dict('lcstacntgen'))(self) == 'actif'
and Lower(Dict('lcgampdt'))(self) == 'epargne'
activity = Dict('lcstacntgen')(self)
account_type = Dict('lcgampdt')(self)
# We ignore accounts without activities or when the activity is 'Closed',
# they are inactive and closed and they don't appear on the website.
return bool(
activity and account_type
and activity.lower() == 'actif'
and account_type.lower() == 'epargne'
)
klass = Account
......
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