works with any subbank

This commit is contained in:
Romain Bignon 2012-05-15 14:09:42 +02:00
commit 95af3239f1

View file

@ -18,6 +18,8 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from urlparse import urlparse
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
from weboob.capabilities.bank import Transfer, TransferError
from datetime import datetime
@ -46,10 +48,7 @@ class CICBrowser(BaseBrowser):
'https://www.cic.fr/.*/fr/banque/.*Vir.*': TransfertPage
}
def __init__(self, *args, **kwargs):
BaseBrowser.__init__(self, *args, **kwargs)
#self.SUB_BANKS = ['cmdv','cmcee','cmse', 'cmidf', 'cmsmb', 'cmma', 'cmmabn', 'cmc', 'cmlaco', 'cmnormandie', 'cmm']
#self.currentSubBank = None
currentSubBank = None
def is_logged(self):
return self.page and not self.is_on_page(LoginPage) and not self.is_on_page(LoginErrorPage)
@ -69,7 +68,6 @@ class CICBrowser(BaseBrowser):
if not self.is_logged() or self.is_on_page(LoginErrorPage):
raise BrowserIncorrectPassword()
self.SUB_BANKS = ['cmdv', 'cmcee', 'cmse', 'cmidf', 'cmsmb', 'cmma', 'cmmabn', 'cmc', 'cmlaco', 'cmnormandie', 'cmm', 'sb']
self.getCurrentSubBank()
def get_accounts_list(self):
@ -89,11 +87,8 @@ class CICBrowser(BaseBrowser):
def getCurrentSubBank(self):
# the account list and history urls depend on the sub bank of the user
current_url = self.geturl()
current_url_parts = current_url.split('/')
for subbank in self.SUB_BANKS:
if subbank in current_url_parts:
self.currentSubBank = subbank
url = urlparse(self.geturl())
self.currentSubBank = url.path.lstrip('/').split('/')[0]
def get_history(self, account):
page_url = account._link_id