python 3.12: utcnow function is deprecated
The following warning is displayed on a system running with Python 3.12: ------------------- /usr/lib/python3.12/site-packages/ipalib/rpc.py:925: DeprecationWarning: datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.now(datetime.UTC). timestamp=datetime.datetime.utcnow()) ------------------- Fixes: https://pagure.io/freeipa/issue/9425 Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com> Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
This commit is contained in:
1 parent
bbb53a1271
commit
09497d2df0
15 files changed
+36
-31
No files matched your search
+1
-1
@@ -943,7 +943,7 @@ class NSSDatabase:
|
||||
def _verify_cert_validity(self, cert):
|
||||
"""Common checks for cert validity
|
||||
"""
|
||||
utcnow = datetime.datetime.utcnow()
|
||||
utcnow = datetime.datetime.now(tz=datetime.UTC)
|
||||
if cert.not_valid_before > utcnow:
|
||||
raise ValueError(
|
||||
f"not valid before {cert.not_valid_before} UTC is in the "
|
||||
|
||||
+1
-1
@@ -652,7 +652,7 @@ class Cookie:
|
||||
|
||||
cookie_expiration = self.get_expiration()
|
||||
if cookie_expiration is not None:
|
||||
now = datetime.datetime.utcnow()
|
||||
now = datetime.datetime.now(tz=datetime.UTC)
|
||||
if cookie_expiration < now:
|
||||
raise Cookie.Expired("cookie named '%s'; expired at %s'" % \
|
||||
(cookie_name,
|
||||
|
||||
Reference in new issue
Block a user