lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.18-12-g8498b37

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

python-stdnum branch master updated. 1.18-12-g8498b37



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  8498b37c419839cae158c35475c7c6a71ab5caa6 (commit)
      from  7e84c05bf1535ce3e645789cc7e2baf81278f7ae (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=8498b37c419839cae158c35475c7c6a71ab5caa6

commit 8498b37c419839cae158c35475c7c6a71ab5caa6
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sat Mar 18 16:41:11 2023 +0100

    Fix date formatting on PyPy 2.7
    
    The original way of calling strftime was likely an artifact of Python
    2.6 support.
    
    Fixes 7e84c05

diff --git a/stdnum/gs1_128.py b/stdnum/gs1_128.py
index 5ebf5ea..703a85c 100644
--- a/stdnum/gs1_128.py
+++ b/stdnum/gs1_128.py
@@ -108,14 +108,14 @@ def _encode_value(fmt, _type, value):
             elif fmt == 'N10':
                 return value.strftime('%y%m%d%H%M')
             elif fmt in ('N6+N..4', 'N6[+N..4]'):
-                value = datetime.datetime.strftime(value, '%y%m%d%H%M')
+                value = value.strftime('%y%m%d%H%M')
                 if value.endswith('00'):
                     value = value[:-2]
                 if value.endswith('00'):
                     value = value[:-2]
                 return value
             elif fmt in ('N8+N..4', 'N8[+N..4]'):
-                value = datetime.datetime.strftime(value, '%y%m%d%H%M%S')
+                value = value.strftime('%y%m%d%H%M%S')
                 if value.endswith('00'):
                     value = value[:-2]
                 if value.endswith('00'):

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

Summary of changes:
 stdnum/gs1_128.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
python-stdnum