Use find object
This commit is contained in:
parent
23b4cc909f
commit
6f5f41fe57
3 changed files with 2 additions and 24 deletions
|
|
@ -18,6 +18,7 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from weboob.capabilities.base import find_object
|
||||
from weboob.capabilities.bank import CapBank, AccountNotFound
|
||||
from weboob.tools.backend import Module, BackendConfig
|
||||
from weboob.tools.value import ValueBackendPassword, Value
|
||||
|
|
@ -60,12 +61,7 @@ class CreditCooperatifModule(Module, CapBank):
|
|||
|
||||
def get_account(self, _id):
|
||||
with self.browser:
|
||||
account = self.browser.get_account(_id)
|
||||
|
||||
if account:
|
||||
return account
|
||||
else:
|
||||
raise AccountNotFound()
|
||||
return find_object(self.browser.get_accounts_list(), id=_id, error=AccountNotFound)
|
||||
|
||||
def iter_history(self, account):
|
||||
with self.browser:
|
||||
|
|
|
|||
|
|
@ -76,15 +76,6 @@ class CreditCooperatif(Browser):
|
|||
|
||||
return self.page.get_list()
|
||||
|
||||
def get_account(self, id):
|
||||
assert isinstance(id, basestring)
|
||||
|
||||
for a in self.get_accounts_list():
|
||||
if a.id == id:
|
||||
return a
|
||||
|
||||
return None
|
||||
|
||||
def get_history(self, account):
|
||||
data = {'accountExternalNumber': account.id}
|
||||
self.location('/portail/particuliers/mescomptes/relevedesoperations.do', urllib.urlencode(data))
|
||||
|
|
|
|||
|
|
@ -76,15 +76,6 @@ class CreditCooperatif(Browser):
|
|||
|
||||
return self.page.get_list()
|
||||
|
||||
def get_account(self, id):
|
||||
assert isinstance(id, basestring)
|
||||
|
||||
for a in self.get_accounts_list():
|
||||
if a.id == id:
|
||||
return a
|
||||
|
||||
return None
|
||||
|
||||
def _get_history(self, link):
|
||||
self.location(link)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue