From b51cc6e5dc6351a0f67c444606414c9bdcb856f6 Mon Sep 17 00:00:00 2001 From: Guillaume Risbourg Date: Mon, 18 Nov 2019 10:37:27 +0100 Subject: [PATCH] [lcl] Changed profile name retrieval for account ownership For some accounts, the profile is unavailable. This lead to the iter_accounts not working because the account ownership crashed on the get_profile. The name of the person can be retrieved on the accounts page, so there is now a new function to retrieve only the profile name. Closes: 51219@sibi --- modules/lcl/browser.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/lcl/browser.py b/modules/lcl/browser.py index 4898deaed6..1b2fb43ead 100644 --- a/modules/lcl/browser.py +++ b/modules/lcl/browser.py @@ -271,7 +271,7 @@ def get_accounts(self): if self.login.is_here(): return self.get_accounts_list() - owner_name = re.search(r' (.+)', self.get_profile().name).group(1).upper() + owner_name = re.search(r' (.+)', self.get_profile_name()).group(1).upper() # retrieve life insurance accounts self.assurancevie.stay_or_go() if self.no_perm.is_here(): @@ -394,7 +394,7 @@ def get_accounts_list(self): a._card_position = card_position self.update_accounts(a) - owner_name = re.search(r' (.+)', self.get_profile().name).group(1).upper() + owner_name = re.search(r' (.+)', self.get_profile_name()).group(1).upper() for account in self.accounts_list: account.owner_type = self.owner_type self.set_ownership(account, owner_name) @@ -641,10 +641,15 @@ def iter_documents(self, subscription): documents.append(document) return documents + def get_profile_name(self): + self.accounts.stay_or_go() + return self.page.get_name() + @need_login def get_profile(self): - self.accounts.stay_or_go() - name = self.page.get_name() + name = self.get_profile_name() + # The self.get_profile_name() already does a + # self.accounts.stay_or_go() self.profile.go(method="POST") profile = self.page.get_profile(name=name) return profile -- GitLab