From 18ec462ac64a00031a0d1152c40b4ffccb0d16f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ball=C3=B3=20Gy=C3=B6rgy?= Date: Mon, 11 Mar 2024 20:30:42 +0100 Subject: [PATCH] Use built-in isoformat support (#383) The ISO formatted string can be stored in multiple formats. Use the built-in datetime.isoformat() and datetime.fromisoformat() functions, which able to handle all variants. Replace 'Z' with '+00:00' to ensure compatibility with Python < 3.11. Fixes: https://github.com/libkeepass/pykeepass/issues/382 --- pykeepass/pykeepass.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pykeepass/pykeepass.py b/pykeepass/pykeepass.py index 08be860b..e0ebc027 100644 --- a/pykeepass/pykeepass.py +++ b/pykeepass/pykeepass.py @@ -28,7 +28,6 @@ BLANK_DATABASE_FILENAME = "blank_database.kdbx" BLANK_DATABASE_LOCATION = os.path.join(os.path.dirname(os.path.realpath(__file__)), BLANK_DATABASE_FILENAME) BLANK_DATABASE_PASSWORD = "password" -DT_ISOFORMAT = "%Y-%m-%dT%H:%M:%S%fZ" class PyKeePass(): """Open a KeePass database @@ -804,7 +803,7 @@ def _encode_time(self, value): struct.pack('