lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.7-2-g74c1721

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

python-stdnum branch master updated. 1.7-2-g74c1721



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-stdnum".

The branch, master has been updated
       via  74c1721b5135ce4489d9585ea747200bbc3ad176 (commit)
       via  12cd072c599ac2fe34fc607a263368f29220e3ba (commit)
      from  4496ffe8d0d2e0b7767959af7f641bc949567995 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://arthurdejong.org/git/python-stdnum/commit/?id=74c1721b5135ce4489d9585ea747200bbc3ad176

commit 74c1721b5135ce4489d9585ea747200bbc3ad176
Author: David Arnold <dar@devco.co>
Date:   Fri Oct 13 20:27:45 2017 -0500

    Handle unicode arguments in get_cc_module()
    
    Closes https://github.com/arthurdejong/python-stdnum/issues/54

diff --git a/stdnum/util.py b/stdnum/util.py
index b04e2c0..7338557 100644
--- a/stdnum/util.py
+++ b/stdnum/util.py
@@ -23,11 +23,6 @@
 This module is meant for internal use by stdnum modules and is not
 guaranteed to remain stable and as such not part of the public API of
 stdnum.
-
->>> get_cc_module('nl', 'vat').__name__
-'stdnum.nl.btw'
->>> get_cc_module('is', 'vat').__name__
-'stdnum.is_.vsk'
 """
 
 import pkgutil
@@ -164,7 +159,7 @@ def get_cc_module(cc, name):
     if cc in ('in', 'is', 'if'):
         cc += '_'
     try:
-        mod = __import__('stdnum.%s' % cc, globals(), locals(), [name])
+        mod = __import__('stdnum.%s' % cc, globals(), locals(), [str(name)])
         return getattr(mod, name, None)
     except ImportError:
         return
diff --git a/tests/test_util.doctest b/tests/test_util.doctest
index 28674b7..c4dc072 100644
--- a/tests/test_util.doctest
+++ b/tests/test_util.doctest
@@ -48,3 +48,22 @@ The doctests should not be present in the descriptions.
 True
 >>> any('>>>' in get_module_description(mod) for mod in get_number_modules())
 False
+
+
+The get_cc_module() function can be used to find a country-specific
+validation module that can be used to validate the number format. It should
+handle aliases properly.
+
+>>> from stdnum.util import get_cc_module
+>>> get_cc_module('gb', 'vat').__name__
+'stdnum.gb.vat'
+>>> get_cc_module('nl', 'vat').__name__
+'stdnum.nl.btw'
+>>> get_cc_module('is', 'vat').__name__
+'stdnum.is_.vsk'
+>>> get_cc_module(u'nl', u'vat').__name__
+'stdnum.nl.btw'
+>>> get_cc_module('unknown', 'vat') is None
+True
+>>> get_cc_module('nl', 'unknown') is None
+True

https://arthurdejong.org/git/python-stdnum/commit/?id=12cd072c599ac2fe34fc607a263368f29220e3ba

commit 12cd072c599ac2fe34fc607a263368f29220e3ba
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Fri Sep 15 11:40:21 2017 +0200

    Fix spelling errors

diff --git a/stdnum/eu/at_02.py b/stdnum/eu/at_02.py
index 8852cd1..8f1147b 100644
--- a/stdnum/eu/at_02.py
+++ b/stdnum/eu/at_02.py
@@ -23,10 +23,10 @@ This identifier is indicated in the ISO 20022 data element 
`Creditor Scheme
 Identification`. The creditor can be a legal entity, or an association that
 is not a legal entity, or a person.
 
-Ther first two digits contain the ISO country code, the nex two are check
+The first two digits contain the ISO country code, the next two are check
 digits for the ISO 7064 Mod 97, 10 checksum, the next tree contain the
-Creditor Bussines Code (or `ZZZ` if no bussness code used) and the remainder
-contain the country-specific identifier.
+Creditor Business Code (or `ZZZ` if no business code used) and the remainder
+contains the country-specific identifier.
 
 >>> validate('ES 23 ZZZ 47690558N')
 'ES23ZZZ47690558N'

-----------------------------------------------------------------------

Summary of changes:
 stdnum/eu/at_02.py      |  6 +++---
 stdnum/util.py          |  7 +------
 tests/test_util.doctest | 19 +++++++++++++++++++
 3 files changed, 23 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
python-stdnum
-- 
To unsubscribe send an email to
python-stdnum-commits-unsubscribe@lists.arthurdejong.org or see
https://lists.arthurdejong.org/python-stdnum-commits/