python-stdnum commit: r48 - python-stdnum/stdnum
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
python-stdnum commit: r48 - python-stdnum/stdnum
- From: Commits of the python-stdnum project <python-stdnum-commits [at] lists.arthurdejong.org>
- To: python-stdnum-commits [at] lists.arthurdejong.org
- Reply-to: python-stdnum-users [at] lists.arthurdejong.org
- Subject: python-stdnum commit: r48 - python-stdnum/stdnum
- Date: Sun, 16 Jan 2011 20:13:13 +0100 (CET)
Author: arthur
Date: Sun Jan 16 20:13:12 2011
New Revision: 48
URL: http://arthurdejong.org/viewvc/python-stdnum?view=rev&revision=48
Log:
fix import of iso7064 modules
Modified:
python-stdnum/stdnum/grid.py
python-stdnum/stdnum/isan.py
Modified: python-stdnum/stdnum/grid.py
==============================================================================
--- python-stdnum/stdnum/grid.py Sun Jan 16 09:49:39 2011 (r47)
+++ python-stdnum/stdnum/grid.py Sun Jan 16 20:13:12 2011 (r48)
@@ -44,12 +44,12 @@
def is_valid(number):
"""Checks to see if the number provided is a valid GRid."""
- from stdnum import iso7064
+ from stdnum.iso7064 import mod_37_36
try:
number = compact(number)
except:
return False
- return len(number) == 18 and iso7064.mod_37_36.is_valid(number)
+ return len(number) == 18 and mod_37_36.is_valid(number)
def format(number, separator='-', add_check_digit=False):
"""Reformat the passed number to the standard format."""
Modified: python-stdnum/stdnum/isan.py
==============================================================================
--- python-stdnum/stdnum/isan.py Sun Jan 16 09:49:39 2011 (r47)
+++ python-stdnum/stdnum/isan.py Sun Jan 16 20:13:12 2011 (r48)
@@ -39,7 +39,7 @@
"""
-from stdnum import iso7064
+from stdnum.iso7064 import mod_37_36
def split(number):
@@ -76,8 +76,8 @@
try:
( root, episode, check1, version, check2 ) = split(number)
return _check(root, 12) and _check(episode, 4) and _check(version, 8,
False) \
- and ( not check1 or iso7064.mod_37_36.is_valid(root+episode+check1)
) \
- and ( not check2 or
iso7064.mod_37_36.is_valid(root+episode+version+check2) )
+ and ( not check1 or mod_37_36.is_valid(root+episode+check1) ) \
+ and ( not check2 or mod_37_36.is_valid(root+episode+version+check2)
)
except:
return False
@@ -90,9 +90,9 @@
if strip_check_digits:
check1 = check2 = ''
if add_check_digits and not check1:
- check1 = iso7064.mod_37_36.calc_check_digit(root+episode)
+ check1 = mod_37_36.calc_check_digit(root+episode)
if add_check_digits and not check2 and version:
- check2 = iso7064.mod_37_36.calc_check_digit(root+episode+version)
+ check2 = mod_37_36.calc_check_digit(root+episode+version)
number = [ root[i:i+4] for i in range(0, 12, 4) ] + [ episode ]
if check1:
number.append(check1)
--
To unsubscribe send an email to
python-stdnum-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/python-stdnum-commits
- python-stdnum commit: r48 - python-stdnum/stdnum,
Commits of the python-stdnum project