From 251eaef0c726c690915ec07ebefe49818a286ebd Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Thu, 16 Oct 2014 11:11:09 +0200 Subject: [PATCH] handle investment pages even if they aren't implemented yet --- modules/fortuneo/browser.py | 16 +++++++++------- modules/fortuneo/pages/accounts_list.py | 3 +++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/modules/fortuneo/browser.py b/modules/fortuneo/browser.py index d9cfbe67..f1c80920 100644 --- a/modules/fortuneo/browser.py +++ b/modules/fortuneo/browser.py @@ -25,7 +25,7 @@ from dateutil.relativedelta import relativedelta from weboob.deprecated.browser import Browser, BrowserIncorrectPassword from .pages.login import LoginPage -from .pages.accounts_list import GlobalAccountsList, AccountsList, AccountHistoryPage +from .pages.accounts_list import GlobalAccountsList, AccountsList, AccountHistoryPage, InvestmentHistoryPage __all__ = ['Fortuneo'] @@ -45,7 +45,8 @@ class Fortuneo(Browser): '.*/prive/mes-comptes/livret/consulter-situation/consulter-solde\.jsp.*' : AccountHistoryPage, '.*/prive/mes-comptes/compte-courant/consulter-situation/consulter-solde\.jsp.*' : AccountHistoryPage, - + '.*/prive/mes-comptes/compte-titres-.*': InvestmentHistoryPage, + '.*/prive/mes-comptes/assurance-vie.*': InvestmentHistoryPage, } def __init__(self, *args, **kwargs): @@ -85,11 +86,12 @@ class Fortuneo(Browser): def get_history(self, account): self.location(account._link_id) - self.select_form(name='ConsultationHistoriqueOperationsForm') - self.set_all_readonly(False) - self['dateRechercheDebut'] = (date.today() - relativedelta(years=1)).strftime('%d/%m/%Y') - self['nbrEltsParPage'] = '100' - self.submit() + if self.is_on_page(AccountHistoryPage): + self.select_form(name='ConsultationHistoriqueOperationsForm') + self.set_all_readonly(False) + self['dateRechercheDebut'] = (date.today() - relativedelta(years=1)).strftime('%d/%m/%Y') + self['nbrEltsParPage'] = '100' + self.submit() return self.page.get_operations(account) diff --git a/modules/fortuneo/pages/accounts_list.py b/modules/fortuneo/pages/accounts_list.py index f294b223..f8db92cb 100644 --- a/modules/fortuneo/pages/accounts_list.py +++ b/modules/fortuneo/pages/accounts_list.py @@ -49,6 +49,9 @@ class Transaction(FrenchTransaction): (re.compile('^(?PREMISE CHEQUES)(?P.*)'), FrenchTransaction.TYPE_DEPOSIT), ] +class InvestmentHistoryPage(Page): + def get_operations(self, _id): + raise NotImplementedError() class AccountHistoryPage(Page): def get_operations(self, _id):