From 56876f8f47d018de2900751631c77272cad5d5b7 Mon Sep 17 00:00:00 2001 From: Quentin Defenouillere Date: Wed, 5 Jun 2019 10:42:34 +0200 Subject: [PATCH] [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 --- modules/lcl/pages.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/lcl/pages.py b/modules/lcl/pages.py index 9f2d50a010..f53e054cc0 100644 --- a/modules/lcl/pages.py +++ b/modules/lcl/pages.py @@ -42,7 +42,7 @@ 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 iter_life_insurance(DictElement): 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 -- GitLab