lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.8.1-8-g92d751c

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

python-stdnum branch master updated. 1.8.1-8-g92d751c



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  92d751cd03ff165f942ee9034399bb942262ad7f (commit)
       via  81947a26fffab3075b51a15f63844b9f89ef318e (commit)
      from  5cbba25f9267c37450a04b72bc0f2f1e7ae8e37a (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=92d751cd03ff165f942ee9034399bb942262ad7f

commit 92d751cd03ff165f942ee9034399bb942262ad7f
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Mon Feb 19 21:42:17 2018 +0100

    Fix PySimpleSOAP DGII result parsing issue
    
    This strips the wrapper that PySimpleSOAP puts around results from the
    DGII PySimpleSOAP SOAP call.
    
    Closes https://github.com/arthurdejong/python-stdnum/issues/64
    Closes https://github.com/arthurdejong/python-stdnum/issues/65

diff --git a/stdnum/do/ncf.py b/stdnum/do/ncf.py
index c59d8b9..51b360d 100644
--- a/stdnum/do/ncf.py
+++ b/stdnum/do/ncf.py
@@ -128,6 +128,8 @@ def check_dgii(rnc, ncf, timeout=30):  # pragma: no cover
         RNC=rnc,
         NCF=ncf,
         IMEI='')
+    if result and 'GetNCFResult' in result:
+        result = result['GetNCFResult']  # PySimpleSOAP only
     if result == '0':
         return
     return _convert_result(result)
diff --git a/stdnum/do/rnc.py b/stdnum/do/rnc.py
index ef6f30a..d1818a0 100644
--- a/stdnum/do/rnc.py
+++ b/stdnum/do/rnc.py
@@ -133,17 +133,19 @@ def check_dgii(number, timeout=30):  # pragma: no cover
             'payment_regime': '2',  # 1: N/D, 2: NORMAL, 3: PST
         }
 
-    Will return none if the number is invalid or unknown."""
+    Will return None if the number is invalid or unknown."""
     # this function isn't automatically tested because it would require
     # network access for the tests and unnecessarily load the online service
     number = compact(number)
     client = get_soap_client(dgii_wsdl, timeout)
-    result = '%s' % client.GetContribuyentes(
+    result = client.GetContribuyentes(
         value=number,
         patronBusqueda=0,   # search type: 0=by number, 1=by name
         inicioFilas=1,      # start result (1-based)
         filaFilas=1,        # end result
         IMEI='')
+    if result and 'GetContribuyentesResult' in result:
+        result = result['GetContribuyentesResult']  # PySimpleSOAP only
     if result == '0':
         return
     return _convert_result(result)
@@ -178,12 +180,14 @@ def search_dgii(keyword, end_at=10, start_at=1, 
timeout=30):  # pragma: no cover
     # this function isn't automatically tested because it would require
     # network access for the tests and unnecessarily load the online service
     client = get_soap_client(dgii_wsdl, timeout)
-    results = '%s' % client.GetContribuyentes(
+    results = client.GetContribuyentes(
         value=keyword,
         patronBusqueda=1,       # search type: 0=by number, 1=by name
         inicioFilas=start_at,   # start result (1-based)
         filaFilas=end_at,       # end result
         IMEI='')
+    if results and 'GetContribuyentesResult' in results:
+        results = results['GetContribuyentesResult']  # PySimpleSOAP only
     if results == '0':
         return []
     return [_convert_result(result) for result in results.split('@@@')]

https://arthurdejong.org/git/python-stdnum/commit/?id=81947a26fffab3075b51a15f63844b9f89ef318e

commit 81947a26fffab3075b51a15f63844b9f89ef318e
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Mon Feb 19 21:30:25 2018 +0100

    Improve get_cc_module() documentation

diff --git a/docs/index.rst b/docs/index.rst
index aa769d1..732be93 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -65,8 +65,11 @@ Helper functions and modules
    particular country. `name` may be an aliased name. For example:
 
        >>> from stdnum import get_cc_module
-       >>> get_cc_module('nl', 'vat')
+       >>> mod = get_cc_module('nl', 'vat')
+       >>> mod
        <module 'stdnum.nl.btw' from '...'>
+       >>> mod.validate('004495445B01')
+       '004495445B01'
 
    Will return ``None`` if no module could be found. The generic names that
    are currently in use:

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

Summary of changes:
 docs/index.rst   |  5 ++++-
 stdnum/do/ncf.py |  2 ++
 stdnum/do/rnc.py | 10 +++++++---
 3 files changed, 13 insertions(+), 4 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/