From d6b868fe0685a40d49e9ae02e269dc651b1cdfea Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Wed, 13 Dec 2023 10:41:22 +0100 Subject: [PATCH] Replace deprecated datetime.utcnow and datetime.utcfromtimestamp --- qwc_services_core/tenant_handler.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/qwc_services_core/tenant_handler.py b/qwc_services_core/tenant_handler.py index 76429a0..195ec83 100644 --- a/qwc_services_core/tenant_handler.py +++ b/qwc_services_core/tenant_handler.py @@ -1,4 +1,4 @@ -from datetime import datetime +import datetime import os import re from flask import request @@ -115,7 +115,7 @@ def register_handler(self, handler_name, tenant, handler): self.handler_cache[handler_name] = handlers handlers[tenant] = { 'handler': handler, - 'last_update': datetime.utcnow() + 'last_update': datetime.datetime.now(datetime.UTC) } return handler @@ -133,8 +133,9 @@ def last_config_update(self, service_name, tenant): ] for path in paths: if os.path.isfile(path): - timestamp = datetime.utcfromtimestamp( - os.path.getmtime(path) + timestamp = datetime.datetime.fromtimestamp( + os.path.getmtime(path), + datetime.UTC ) if ( last_config_update is None