Commit 56876f8f authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by hydrargyrum
Browse files

[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 @@ ...@@ -42,7 +42,7 @@
from weboob.browser.filters.html import Attr, Link, TableCell, AttributeNotFound from weboob.browser.filters.html import Attr, Link, TableCell, AttributeNotFound
from weboob.browser.filters.standard import ( from weboob.browser.filters.standard import (
CleanText, Field, Regexp, Format, Date, CleanDecimal, Map, AsyncLoad, Async, Env, Slugify, 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.browser.filters.json import Dict
from weboob.exceptions import BrowserUnavailable, BrowserIncorrectPassword from weboob.exceptions import BrowserUnavailable, BrowserIncorrectPassword
...@@ -963,9 +963,14 @@ class iter_life_insurance(DictElement): ...@@ -963,9 +963,14 @@ class iter_life_insurance(DictElement):
class item(ItemElement): class item(ItemElement):
def condition(self): def condition(self):
return ( activity = Dict('lcstacntgen')(self)
Lower(Dict('lcstacntgen'))(self) == 'actif' account_type = Dict('lcgampdt')(self)
and Lower(Dict('lcgampdt'))(self) == 'epargne' # 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 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