From a33133740411d9120af0d2af9352e58c01d93321 Mon Sep 17 00:00:00 2001 From: jonathan nifenecker Date: Wed, 28 Oct 2020 13:30:47 +0100 Subject: [PATCH] [cragr] Fix transaction raw patterns parsing - the Transaction.Raw was not call in some cases - when called, it correctly set the obj_label but that field was overriden afterwards. --- modules/cragr/pages.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/modules/cragr/pages.py b/modules/cragr/pages.py index 500339ccca..ef4796dd6a 100644 --- a/modules/cragr/pages.py +++ b/modules/cragr/pages.py @@ -576,6 +576,14 @@ class item(ItemElement): # we do not use it. obj_date = Date(CleanText(Dict('dateOperation'))) + obj_label = CleanText( + Format( + '%s %s', + CleanText(Dict('libelleTypeOperation', default='')), + CleanText(Dict('libelleOperation')) + ) + ) + # Transactions in foreign currencies have no 'libelleTypeOperation' # and 'libelleComplementaire' keys, hence the default values. # The CleanText() gets rid of additional spaces. @@ -604,11 +612,6 @@ def obj_rdate(self): return rdate return date - obj_label = CleanText( - Format( - '%s %s', CleanText(Dict('libelleTypeOperation', default='')), CleanText(Dict('libelleOperation')) - ) - ) obj_amount = Eval(float_to_decimal, Dict('montant')) obj_type = Map( CleanText(Dict('libelleTypeOperation', default='')), TRANSACTION_TYPES, Transaction.TYPE_UNKNOWN @@ -655,8 +658,8 @@ class iter_card_history(DictElement): class item(ItemElement): klass = Transaction - obj_raw = CleanText(Dict('libelleOperation')) obj_label = CleanText(Dict('libelleOperation')) + obj_raw = Transaction.Raw(CleanText(Dict('libelleOperation'))) obj_amount = Eval(float_to_decimal, Dict('montant')) obj_type = Transaction.TYPE_DEFERRED_CARD obj_bdate = Field('rdate') -- GitLab