diff --git a/horizon/utils/functions.py b/horizon/utils/functions.py index b4d5622d50..92d38f8ee2 100644 --- a/horizon/utils/functions.py +++ b/horizon/utils/functions.py @@ -15,6 +15,7 @@ import decimal import math import re +from oslo_utils import timeutils from oslo_utils import units from django.conf import settings @@ -186,5 +187,4 @@ def format_value(value): def one_year_from_now(): - now = datetime.datetime.utcnow() - return now + datetime.timedelta(days=365) + return timeutils.utcnow() + datetime.timedelta(days=365) diff --git a/openstack_dashboard/api/swift.py b/openstack_dashboard/api/swift.py index ff67d5592c..b4a9bc6a6e 100644 --- a/openstack_dashboard/api/swift.py +++ b/openstack_dashboard/api/swift.py @@ -198,7 +198,9 @@ def swift_get_container(request, container_name, with_data=False): parameters = parse.quote(container_name.encode('utf8')) public_url = swift_endpoint + '/' + parameters ts_float = float(headers.get('x-timestamp')) - timestamp = datetime.utcfromtimestamp(ts_float).isoformat() + timestamp = datetime.fromtimestamp( + ts_float, tz=datetime.timezone.utc).replace( + tzinfo=None).isoformat() except Exception: pass container_info = { @@ -411,7 +413,9 @@ def swift_get_object(request, container_name, object_name, with_data=True, timestamp = None try: ts_float = float(headers.get('x-timestamp')) - timestamp = datetime.utcfromtimestamp(ts_float).isoformat() + timestamp = datetime.fromtimestamp( + ts_float, tz=datetime.timezone.utc).replace( + tzinfo=None).isoformat() except Exception: pass obj_info = { diff --git a/requirements.txt b/requirements.txt index e7178e2028..a6cdf32309 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,7 +19,7 @@ oslo.i18n>=5.1.0 # Apache-2.0 oslo.policy>=3.11.0 # Apache-2.0 oslo.serialization>=4.3.0 # Apache-2.0 oslo.upgradecheck>=1.5.0 # Apache-2.0 -oslo.utils>=4.12.0 # Apache-2.0 +oslo.utils>=7.0.0 # Apache-2.0 osprofiler>=3.4.2 # Apache-2.0 pyScss>=1.4.0 # MIT License python-cinderclient>=8.0.0 # Apache-2.0