lists.arthurdejong.org
RSS feed

python-stdnum commit: r59 - python-stdnum/stdnum

[Date Prev][Date Next] [Thread Prev][Thread Next]

python-stdnum commit: r59 - python-stdnum/stdnum



Author: arthur
Date: Sat Feb  5 23:08:27 2011
New Revision: 59
URL: http://arthurdejong.org/viewvc/python-stdnum?view=rev&revision=59

Log:
move more validation into try/except (specifically the _convert() call)

Modified:
   python-stdnum/stdnum/iban.py

Modified: python-stdnum/stdnum/iban.py
==============================================================================
--- python-stdnum/stdnum/iban.py        Sat Feb  5 23:03:16 2011        (r58)
+++ python-stdnum/stdnum/iban.py        Sat Feb  5 23:08:27 2011        (r59)
@@ -75,11 +75,11 @@
     """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
-- 
To unsubscribe send an email to
python-stdnum-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/python-stdnum-commits