Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/stdnum/iban.py
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2011-02-05 23:08:27 +0100
committerArthur de Jong <arthur@arthurdejong.org>2011-02-05 23:08:27 +0100
commit33611d104fd11f97e93611799bbfab51ed989c6f (patch)
tree6bb3e817975cccac3da84f74280646e84f7f7e2d /stdnum/iban.py
parent62aa49665ef40c692e194da3ae05d1df11483685 (diff)
move more validation into try/except (specifically the _convert() call)
git-svn-id: http://arthurdejong.org/svn/python-stdnum/python-stdnum@59 9dea7c4f-944c-4273-ac1a-574ede026edc
Diffstat (limited to 'stdnum/iban.py')
-rw-r--r--stdnum/iban.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/stdnum/iban.py b/stdnum/iban.py
index 86fa8b7..3edddf1 100644
--- a/stdnum/iban.py
+++ b/stdnum/iban.py
@@ -75,11 +75,11 @@ def is_valid(number):
"""Checks to see if the number provided is a valid IBAN."""
try:
number = compact(number)
+ # ensure that checksum is valid
+ if not mod_97_10.is_valid(_convert(number)):
+ return False
except:
return False
- # ensure that checksum is valid
- if not mod_97_10.is_valid(_convert(number)):
- return False
# look up the number
info = _ibandb.info(number)
# check if the number has the correct structure