Commit b270d104 authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by Vincent A

[wiseed] Handle valuations in US format

For some connections the valuations are displayed in the US Format
(€100.00) instead of the French format so we handle both cases with
parent 132b76a5
......@@ -21,9 +21,12 @@ from __future__ import unicode_literals
from weboob.browser.pages import LoggedPage, HTMLPage
from weboob.browser.filters.html import TableCell
from weboob.browser.filters.standard import CleanText, CleanDecimal, Regexp
from weboob.browser.filters.standard import (
CleanText, CleanDecimal, Regexp, Coalesce,
from weboob.browser.elements import method, ItemElement, TableElement
from weboob.exceptions import BrowserIncorrectPassword
from weboob.capabilities.base import NotAvailable
from weboob.capabilities.wealth import Investment
from import create_french_liquidity
......@@ -54,7 +57,10 @@ class InvestPage(LoggedPage, HTMLPage):
def get_liquidities(self):
value = CleanDecimal.French(CleanText('//a[starts-with(text(),"Compte de paiement")]'))(self.doc)
value = Coalesce(
CleanDecimal.French('//a[starts-with(text(),"Compte de paiement")]', default=NotAvailable),
CleanDecimal.US('//a[starts-with(text(),"Compte de paiement")]', default=NotAvailable),
return create_french_liquidity(value)
......@@ -115,7 +121,9 @@ class InvestPage(LoggedPage, HTMLPage):
klass = Investment
obj_label = CleanText(TableCell('label'))
obj_valuation = CleanDecimal.French(Regexp(
r'^(.*?) €', # can be 100,00 € + Frais de 0,90 €
# Can be "100,00 € + Frais de 0,90 €" or "€100.00"
obj_valuation = Coalesce(
CleanDecimal.French(Regexp(CleanText(TableCell('details')), r'^(.*?) €', default=None), default=None),
CleanDecimal.US(Regexp(CleanText(TableCell('details')), r'^€([^ ]+)', default=None), default=None),
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