python-stdnum branch master updated. 1.6-3-g5604d91
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
python-stdnum branch master updated. 1.6-3-g5604d91
- 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 branch master updated. 1.6-3-g5604d91
- Date: Thu, 13 Apr 2017 22:39:25 +0200 (CEST)
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 5604d91be8e92f12b0bf2c599bb858e8f3704143 (commit)
via d14ea3bddb010a974fae79f854b744e1319a8808 (commit)
from 6b588d1c39ff75f853b97af37aa0724745aff65f (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=5604d91be8e92f12b0bf2c599bb858e8f3704143
commit 5604d91be8e92f12b0bf2c599bb858e8f3704143
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Thu Apr 13 22:37:33 2017 +0200
Switch to HTTPS URLs
diff --git a/docs/index.rst b/docs/index.rst
index 56c6fc7..e56ceff 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -9,7 +9,7 @@ in different formats. It contains a large collection of number
formats.
Basically any number or code that has some validation mechanism available
or some common formatting is eligible for inclusion in this library.
-http://arthurdejong.org/python-stdnum/
+https://arthurdejong.org/python-stdnum/
Common Interface
diff --git a/setup.py b/setup.py
index 941ff4e..de67e5b 100755
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@
# setup.py - python-stdnum installation script
#
-# Copyright (C) 2010-2016 Arthur de Jong
+# Copyright (C) 2010-2017 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -38,7 +38,7 @@ setup(name='python-stdnum',
long_description=stdnum.__doc__,
author='Arthur de Jong',
author_email='arthur@arthurdejong.org',
- url='http://arthurdejong.org/python-stdnum/',
+ url='https://arthurdejong.org/python-stdnum/',
license='LGPL',
classifiers=[
'Development Status :: 5 - Production/Stable',
diff --git a/stdnum/fr/nir.py b/stdnum/fr/nir.py
index bf1206a..c9381b2 100644
--- a/stdnum/fr/nir.py
+++ b/stdnum/fr/nir.py
@@ -2,7 +2,7 @@
# coding: utf-8
#
# Copyright (C) 2016 Dimitri Papadopoulos
-# Copyright (C) 2016 Arthur de Jong
+# Copyright (C) 2016-2017 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -33,7 +33,7 @@ the location of birth (COG), 3 for a serial and 2 check
digits.
More information:
-* http://www.insee.fr/en/methodes/default.asp?page=definitions/nir.htm
+* https://www.insee.fr/en/metadonnees/definition/c1409
* https://en.wikipedia.org/wiki/INSEE_code
* http://resoo.org/docs/_docs/regles-numero-insee.pdf
* https://fr.wikipedia.org/wiki/Numéro_de_sécurité_sociale_en_France
diff --git a/stdnum/fr/siren.py b/stdnum/fr/siren.py
index 543f428..ff06b69 100644
--- a/stdnum/fr/siren.py
+++ b/stdnum/fr/siren.py
@@ -1,7 +1,7 @@
# siren.py - functions for handling French SIREN numbers
# coding: utf-8
#
-# Copyright (C) 2012, 2013 Arthur de Jong
+# Copyright (C) 2012-2017 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -44,7 +44,7 @@ from stdnum.util import clean
# An online validation function is available but it does not provide an
# automated entry point, has usage restrictions and seems to require
# attribution to the service for any results used.
-# http://avis-situation-sirene.insee.fr/
+# https://avis-situation-sirene.insee.fr/
def compact(number):
diff --git a/stdnum/gb/nhs.py b/stdnum/gb/nhs.py
index c1367e3..286d41d 100644
--- a/stdnum/gb/nhs.py
+++ b/stdnum/gb/nhs.py
@@ -1,6 +1,6 @@
# nhs.py - functions for handling United Kingdom NHS numbers
#
-# Copyright (C) 2016 Arthur de Jong
+# Copyright (C) 2016-2017 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -28,7 +28,7 @@ More information:
* https://en.wikipedia.org/wiki/NHS_number
* http://www.nhs.uk/NHSEngland/thenhs/records/nhs-number/
-* http://systems.hscic.gov.uk/nhsnumber
+* https://digital.nhs.uk/article/301/NHS-Number
*
http://www.datadictionary.nhs.uk/data_dictionary/attributes/n/nhs/nhs_number_de.asp
>>> validate('943-476-5870')
diff --git a/stdnum/isil.py b/stdnum/isil.py
index ec1afd6..d16cc46 100644
--- a/stdnum/isil.py
+++ b/stdnum/isil.py
@@ -1,7 +1,7 @@
# isil.py - functions for handling identifiers for libraries and related
# organizations
#
-# Copyright (C) 2011-2015 Arthur de Jong
+# Copyright (C) 2011-2017 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -41,7 +41,7 @@ More information:
* https://en.wikipedia.org/wiki/ISBT_128
* http://biblstandard.dk/isil/
-* http://www.iso.org/iso/catalogue_detail?csnumber=57332
+* https://www.iso.org/standard/57332.html
>>> validate('IT-RM0267')
'IT-RM0267'
diff --git a/stdnum/iso6346.py b/stdnum/iso6346.py
index 1956dfc..6a60321 100644
--- a/stdnum/iso6346.py
+++ b/stdnum/iso6346.py
@@ -1,7 +1,7 @@
# iso6346.py - functions for handling ISO 6346
#
# Copyright (C) 2014 Openlabs Technologies & Consulting (P) Limited
-# Copyright (C) 2014 Arthur de Jong
+# Copyright (C) 2014-2017 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -30,7 +30,7 @@ Container Bureau (BIC).
More information:
-* http://en.wikipedia.org/wiki/ISO_6346
+* https://en.wikipedia.org/wiki/ISO_6346
>>> validate('csqu3054383')
'CSQU3054383'
diff --git a/stdnum/lv/pvn.py b/stdnum/lv/pvn.py
index dbb3b00..e230c2f 100644
--- a/stdnum/lv/pvn.py
+++ b/stdnum/lv/pvn.py
@@ -1,7 +1,7 @@
# pvn.py - functions for handling Latvian PVN (VAT) numbers
# coding: utf-8
#
-# Copyright (C) 2012-2015 Arthur de Jong
+# Copyright (C) 2012-2017 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -47,7 +47,7 @@ from stdnum.util import clean
# validation functions are available on-line but it is not allowed
# to perform automated queries:
-# http://www6.vid.gov.lv/VID_PDB?aspxerrorpath=/vid_pdb/pvn.asp
+# https://www6.vid.gov.lv/VID_PDB?aspxerrorpath=/vid_pdb/pvn.asp
def compact(number):
diff --git a/stdnum/nl/brin.py b/stdnum/nl/brin.py
index 1975f77..bf9db25 100644
--- a/stdnum/nl/brin.py
+++ b/stdnum/nl/brin.py
@@ -1,6 +1,6 @@
# brin.py - functions for handling Brin numbers
#
-# Copyright (C) 2013 Arthur de Jong
+# Copyright (C) 2013-2017 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -25,7 +25,7 @@ characters, sometimes extended with two digits to indicate
the site (this
complete code is called the vestigingsnummer).
The register of these numbers can be downloaded from:
-http://www.duo.nl/organisatie/open_onderwijsdata/databestanden/default.asp
+https://www.duo.nl/open_onderwijsdata/databestanden/
>>> validate('05 KO')
'05KO'
diff --git a/stdnum/us/ein.dat b/stdnum/us/ein.dat
index d4d72e0..0b6dd7a 100644
--- a/stdnum/us/ein.dat
+++ b/stdnum/us/ein.dat
@@ -1,5 +1,5 @@
# manually converted from the IRS website
-#
http://www.irs.gov/Businesses/Small-Businesses-&-Self-Employed/How-EINs-are-Assigned-and-Valid-EIN-Prefixes
+#
https://www.irs.gov/businesses/small-businesses-self-employed/how-eins-are-assigned-and-valid-ein-prefixes
01,02,03,04,05,06,11,13,14,16,21,22,23,25,34,51,52,54,55,56,57,58,59,65
campus="Brookhaven"
10,12 campus="Andover"
diff --git a/tests/test_al_nipt.doctest b/tests/test_al_nipt.doctest
index 786ebb7..471b432 100644
--- a/tests/test_al_nipt.doctest
+++ b/tests/test_al_nipt.doctest
@@ -1,6 +1,6 @@
test_al_nitp.doctest - more detailed doctests stdnum.al.nipt
-Copyright (C) 2015 Arthur de Jong
+Copyright (C) 2015-2017 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -26,7 +26,7 @@ This file contains more detailed doctests for the
stdnum.al.nipt module.
These have been found online and should all be valid numbers. There is also
a validation service at
-http://www.qkr.gov.al/nrc/kerko_per_subjekt.aspx
+http://www.qkr.gov.al/kerko/kerko-ne-regjistrin-tregtar/kerko-per-subjekt/
>>> numbers = '''
...
https://arthurdejong.org/git/python-stdnum/commit/?id=d14ea3bddb010a974fae79f854b744e1319a8808
commit d14ea3bddb010a974fae79f854b744e1319a8808
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Thu Apr 13 21:00:19 2017 +0200
Show possible conversions in online check
This shows possible converted values. For example it will show ISBN13
conversions for ISBN10 values.
diff --git a/online_check/README b/online_check/README
index 38841e2..8ab69e7 100644
--- a/online_check/README
+++ b/online_check/README
@@ -4,8 +4,12 @@ formats are valid for a supplied number as can be seen online
at:
Configuring the WSGI application in Apache.
-# /path/to/wsgi is the directory containing the WSGI scripts
-# /path/to/html is the directory containing the static files
+- /path/to/wsgi is the directory containing the WSGI scripts
+- /path/to/html is the directory containing the static files
+
+The python-stdnum checkout is expected to be available in
+/path/to/wsgi/python-stdnum.
+
WSGIDaemonProcess stdnum threads=5 maximum-requests=100 display-name=%{GROUP}
<Directory /path/to/wsgi>
diff --git a/online_check/check.js b/online_check/check.js
index b52633f..9c5025d 100644
--- a/online_check/check.js
+++ b/online_check/check.js
@@ -43,6 +43,13 @@ $( document ).ready(function() {
$("<div/>").text(result["number"]).html(),
"<p>",
format(result["description"]),
+ $.map(result["conversions"], function(value, key){
+ return [
+ "<br/><b><i>",
+ $("<div/>").text(key).html(),
+ "</i></b>: ",
+ $("<div/>").text(value).html()].join('')
+ }).join(''),
"</p></li>")
});
h.push("</ul>");
@@ -93,4 +100,7 @@ $( document ).ready(function() {
// hide the submit button
$(".stdnum_hide").hide();
+ // focus the text field
+ $(".stdnum_check").focus();
+
});
diff --git a/online_check/stdnum.wsgi b/online_check/stdnum.wsgi
index c193158..729f3eb 100755
--- a/online_check/stdnum.wsgi
+++ b/online_check/stdnum.wsgi
@@ -22,6 +22,7 @@ import json
import os
import re
import sys
+import inspect
sys.stdout = sys.stderr
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'python-stdnum'))
@@ -33,7 +34,24 @@ from stdnum.util import (
_template = None
+def get_conversions(module, number):
+ """Return the possible conversions for the number."""
+ for name, func in inspect.getmembers(module, inspect.isfunction):
+ if name.startswith('to_'):
+ args, varargs, varkw, defaults = inspect.getargspec(func)
+ if defaults:
+ args = args[:-len(defaults)]
+ if args == ['number']:
+ try:
+ conversion = func(number)
+ if conversion != number:
+ yield (name[3:], conversion)
+ except Exception:
+ pass
+
+
def info(module, number):
+ """Return information about the number."""
compactfn = getattr(module, 'compact', lambda x: x)
formatfn = getattr(module, 'format', compactfn)
return dict(
@@ -42,7 +60,8 @@ def info(module, number):
valid=module.is_valid(number),
module=module.__name__.split('.', 1)[1],
name=get_module_name(module),
- description=get_module_description(module))
+ description=get_module_description(module),
+ conversions=dict(get_conversions(module, number)))
def format(data):
@@ -54,6 +73,9 @@ def format(data):
r'\b((https?|ftp)://[^\s<]*[-\w+&@#/%=~_|])',
r'<a href="\1">\1</a>',
description, flags=re.IGNORECASE + re.UNICODE)
+ for name, conversion in data.get('conversions', {}).items():
+ description += '\n<br/><b><i>%s</i></b>: %s' % (
+ cgi.escape(name), cgi.escape(conversion))
return '<li><b>%s</b><br/>%s<p>%s</p></li>' % (
cgi.escape(data['name']),
cgi.escape(data['number']),
@@ -68,10 +90,8 @@ def application(environ, start_response):
environ['DOCUMENT_ROOT'],
os.path.dirname(environ['SCRIPT_NAME']).strip('/'))
_template = open(os.path.join(basedir, 'template.html'), 'r').read()
-
is_ajax = environ.get(
'HTTP_X_REQUESTED_WITH', '').lower() == 'xmlhttprequest'
-
parameters = cgi.parse_qs(environ.get('QUERY_STRING', ''))
results = []
if 'number' in parameters:
-----------------------------------------------------------------------
Summary of changes:
docs/index.rst | 2 +-
online_check/README | 8 ++++++--
online_check/check.js | 10 ++++++++++
online_check/stdnum.wsgi | 26 +++++++++++++++++++++++---
setup.py | 4 ++--
stdnum/fr/nir.py | 4 ++--
stdnum/fr/siren.py | 4 ++--
stdnum/gb/nhs.py | 4 ++--
stdnum/isil.py | 4 ++--
stdnum/iso6346.py | 4 ++--
stdnum/lv/pvn.py | 4 ++--
stdnum/nl/brin.py | 4 ++--
stdnum/us/ein.dat | 2 +-
tests/test_al_nipt.doctest | 4 ++--
14 files changed, 59 insertions(+), 25 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/
- python-stdnum branch master updated. 1.6-3-g5604d91,
Commits of the python-stdnum project