The new woob repository is here: https://gitlab.com/woob/woob. This gitlab will be removed soon.

Commit 10d20e48 authored by Florent Viard's avatar Florent Viard Committed by Vincent A

[creditmutuel] iter_documents: fixes formnotfound error when access is not allowed to documents

parent 200516b0
......@@ -1262,7 +1262,19 @@ def iter_subscriptions(self):
def iter_documents(self, subscription):
if self.currentSubBank is None:
self.getCurrentSubBank()
self.iban.go(subbank=self.currentSubBank)
iban_document = self.page.get_iban_document(subscription)
if iban_document:
yield iban_document
self.subscription.go(subbank=self.currentSubBank, params={'typ': 'doc'})
access_not_allowed_msg = "Vous ne disposez pas des droits nécessaires pour accéder à cette partie de l'application."
if access_not_allowed_msg in self.page.error_msg():
self.logger.warning("Bank user account has insufficient right to access the documents page")
return
link_to_bank_statements = self.page.get_link_to_bank_statements()
self.location(link_to_bank_statements)
......@@ -1287,12 +1299,6 @@ def iter_documents(self, subscription):
if self.page.is_last_page():
break
self.iban.go(subbank=self.currentSubBank)
iban_document = self.page.get_iban_document(subscription)
if iban_document:
yield iban_document
@need_login
def iter_emitters(self):
......
......@@ -2651,6 +2651,9 @@ class RevolvingLoanDetails(LoggedPage, HTMLPage):
class SubscriptionPage(LoggedPage, HTMLPage):
def error_msg(self):
return CleanText('//div[@id="errmsg"]/p')(self.doc)
def get_link_to_bank_statements(self):
return Link('//a[@id="C:R1:N"]')(self.doc)
......
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