From 4e213b9d0963f1f0880b7a7147c072ea476a8f18 Mon Sep 17 00:00:00 2001 From: Quentin Defenouillere Date: Thu, 26 Jul 2018 16:02:10 +0200 Subject: [PATCH] [creditmutuel/cic] Remove trash from Transactions labels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The infamous "Cliquer pour déplier ou plier le détail de l’opération" is back! This is linked to the commit 6d41bfaf that removes this piece of some transaction labels ; but it turns out that now it's not located in parts[0] instead of parts[1]. I first remove all empty strings and then look for the string that we want to get rid of ; if it's there I remove it from the list, this way it is more dynamic that parts[0] or parts[1]. Tested with CIC and creditmutuel connections. Closes: 6378@zendesk, 6382@zendesk, 6381@zendesk, 6398@zendesk --- modules/creditmutuel/pages.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/creditmutuel/pages.py b/modules/creditmutuel/pages.py index 69df183656..a94794a16f 100644 --- a/modules/creditmutuel/pages.py +++ b/modules/creditmutuel/pages.py @@ -645,11 +645,14 @@ def __call__(self, item): # hideifscript: Date de valeur XX/XX/XXXX # fd: Avis d'opéré # survey to add other regx - parts = [re.sub('Détail|Date de valeur\s+:\s+\d{2}/\d{2}(/\d{4})?', '', txt.strip()) for txt in el.itertext() if len(txt.strip()) > 0] + parts = (re.sub('Détail|Date de valeur\s+:\s+\d{2}/\d{2}(/\d{4})?', '', txt.strip()) for txt in el.itertext() if len(txt.strip()) > 0) + # Removing empty strings: + parts = [s for s in parts if s] # To simplify categorization of CB, reverse order of parts to separate # location and institution. - if parts[0] == u"Cliquer pour déplier ou plier le détail de l'opération": - parts.pop(0) + detail = "Cliquer pour déplier ou plier le détail de l'opération" + if detail in parts: + parts.remove(detail) if parts[0].startswith('PAIEMENT CB'): parts.reverse() -- GitLab