From 33611d104fd11f97e93611799bbfab51ed989c6f Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Sat, 5 Feb 2011 22:08:27 +0000 Subject: 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 --- stdnum/iban.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'stdnum/iban.py') 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 -- cgit v1.2.3