mirror of
https://github.com/ansible/awx.git
synced 2026-06-22 15:17:44 -02:30
Replace pytz with standard library timezone (#16197)
Refactored code to use Python's built-in datetime.timezone and zoneinfo instead of pytz for timezone handling. This modernizes the codebase and removes the dependency on pytz, aligning with current best practices for timezone-aware datetime objects.
This commit is contained in:
@@ -50,7 +50,7 @@ from rest_framework_yaml.renderers import YAMLRenderer
|
||||
# ansi2html
|
||||
from ansi2html import Ansi2HTMLConverter
|
||||
|
||||
import pytz
|
||||
from datetime import timezone as dt_timezone
|
||||
from wsgiref.util import FileWrapper
|
||||
|
||||
# django-ansible-base
|
||||
@@ -648,7 +648,7 @@ class SchedulePreview(GenericAPIView):
|
||||
continue
|
||||
schedule.append(event)
|
||||
|
||||
return Response({'local': schedule, 'utc': [s.astimezone(pytz.utc) for s in schedule]})
|
||||
return Response({'local': schedule, 'utc': [s.astimezone(dt_timezone.utc) for s in schedule]})
|
||||
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user