lists.arthurdejong.org
RSS feed

python-stdnum commit: r2 - python-stdnum/stdnum/isbn

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

python-stdnum commit: r2 - python-stdnum/stdnum/isbn



Author: arthur
Date: Fri Jul 23 15:51:05 2010
New Revision: 2
URL: http://arthurdejong.org/viewvc/python-stdnum?view=rev&revision=2

Log:
get rid of remainders of old code that used exceptions

Modified:
   python-stdnum/stdnum/isbn/__init__.py

Modified: python-stdnum/stdnum/isbn/__init__.py
==============================================================================
--- python-stdnum/stdnum/isbn/__init__.py       Fri Jul 23 15:40:33 2010        
(r1)
+++ python-stdnum/stdnum/isbn/__init__.py       Fri Jul 23 15:51:05 2010        
(r2)
@@ -62,36 +62,19 @@
     number = compact(number)
     if len(number) == 10:
         if not number[:-1].isdigit():
-            #raise ValueError('ISBN should be numeric')
             return None
         if _calc_isbn10_check_digit(number[:-1]) != number[-1]:
-            #raise ValueError('ISBN check digit incorrect')
             return None
         return 'ISBN10'
     elif len(number) == 13:
         if not number.isdigit():
-            #raise ValueError('ISBN should be numeric')
             return None
         if _calc_isbn13_check_digit(number[:-1]) != number[-1]:
-            #raise ValueError('ISBN check digit incorrect')
             return None
         return 'ISBN13'
     else:
-        #raise ValueError('ISBN has invalid length')
         return None
 
-
-    '''
-    try:
-        number = compact(number)
-    except ValueError:
-        return None
-    if len(number) == 10:
-        return 'ISBN10'
-    else:
-        return 'ISBN13'
-    '''
-
 def validate(number):
     """Checks to see if the number provided is a valid ISBN (either a legacy
     10-digit one or a 13-digit one). This checks the length and the check
--
To unsubscribe send an email to
python-stdnum-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/python-stdnum-commits