From 8c1decb1633e3d5de4a36ee87ae856440f9f3d89 Mon Sep 17 00:00:00 2001 From: "Pieter J. Kersten" Date: Fri, 12 Feb 2010 19:04:33 +0100 Subject: [PATCH] [IMP] account_banking: moved check on SEPA countries from iban.__init__ to iban.valid to ease tests --- account_banking/sepa/iban.py | 7 ++----- account_banking_nl_clieop/wizard/export_clieop.py | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/account_banking/sepa/iban.py b/account_banking/sepa/iban.py index 338bfd683..e4a8d429d 100644 --- a/account_banking/sepa/iban.py +++ b/account_banking/sepa/iban.py @@ -277,12 +277,8 @@ class IBAN(str): Sanity check: don't offer extensions unless the base is sound. ''' super(IBAN, self).__init__() - # Rearrange position of country code and check digits if self.countrycode not in self.countries: self.BBAN_format = self.unknown_BBAN_format - raise Warning, \ - 'Don\'t know how to format BBAN for country %s' % \ - self.countrycode else: self.BBAN_format = self.BBAN_formats[self.countrycode] @@ -326,7 +322,8 @@ class IBAN(str): Check if the string + check digits deliver a valid checksum ''' _buffer = self[4:] + self[:4] - return int(base36_to_base10str(_buffer)) % 97 == 1 + return self.countrycode in self.countries and \ + int(base36_to_base10str(_buffer)) % 97 == 1 def __repr__(self): ''' diff --git a/account_banking_nl_clieop/wizard/export_clieop.py b/account_banking_nl_clieop/wizard/export_clieop.py index 620aa937a..21eb38c1c 100644 --- a/account_banking_nl_clieop/wizard/export_clieop.py +++ b/account_banking_nl_clieop/wizard/export_clieop.py @@ -24,7 +24,6 @@ import pooler import base64 from datetime import datetime, date, timedelta from account_banking import sepa -#from osv import osv from tools.translate import _ #import pdb; pdb.set_trace() import clieop @@ -298,6 +297,7 @@ def _create_clieop(self, cursor, uid, data, context): kwargs['messages'] = [line.communication2] other_account_nr = line.bank_id.acc_number iban = sepa.IBAN(other_account_nr) + # Is this an IBAN account? if iban.valid: if iban.countrycode != 'NL': raise wizard.except_wizard(