lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.11-46-g54218b1

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

python-stdnum branch master updated. 1.11-46-g54218b1



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  54218b11fdd238dae495a24ceee5f72e7d52b3be (commit)
      from  790a0526e66c006d16e148174c99f964c52e98d4 (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=54218b11fdd238dae495a24ceee5f72e7d52b3be

commit 54218b11fdd238dae495a24ceee5f72e7d52b3be
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Mon Oct 14 20:24:29 2019 +0200

    Fix rrn documentation
    
    This also fixes Python 2.6 compatibility.
    
    Fixes 790a052

diff --git a/stdnum/kr/rrn.py b/stdnum/kr/rrn.py
index 1b6abee..35fdb99 100644
--- a/stdnum/kr/rrn.py
+++ b/stdnum/kr/rrn.py
@@ -66,15 +66,14 @@ def calc_check_digit(number):
 
 def get_birth_date(number, allow_future=True):
     """Split the date parts from the number and return the birth date. If
-    allow_future is True birth dates in the future are rejected."""
+    allow_future is False birth dates in the future are rejected."""
     number = compact(number)
     year = int(number[0:2])
     month = int(number[2:4])
     day = int(number[4:6])
-    century = int(number[6])
-    if century in {1, 2, 5, 6}:  # born 1900-1999
+    if number[6] in '1256':  # born 1900-1999
         year += 1900
-    elif century in {3, 4, 7, 8}:  # born 2000-2099
+    elif number[6] in '3478':  # born 2000-2099
         year += 2000
     else:  # born 1800-1899
         year += 1800
@@ -93,7 +92,7 @@ def get_birth_date(number, allow_future=True):
 
 def validate(number, allow_future=True):
     """Check if the number is a valid RNN. This checks the length, formatting
-    and check digit. If allow_future is True birth dates in the future are
+    and check digit. If allow_future is False birth dates in the future are
     rejected."""
     number = compact(number)
     if not isdigits(number):

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

Summary of changes:
 stdnum/kr/rrn.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
python-stdnum