Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker/base.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9-bookworm
FROM python:3.12-bookworm
LABEL maintainer="IETF Tools Team <tools-discuss@ietf.org>"

ENV DEBIAN_FRONTEND=noninteractive
Expand Down
2 changes: 1 addition & 1 deletion ietf/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,4 @@ def dehydrate(self, bundle, for_list=True):

class Serializer(tastypie.serializers.Serializer):
def format_datetime(self, data):
return data.astimezone(datetime.timezone.utc).replace(tzinfo=None).isoformat(timespec="seconds") + "Z"
return data.astimezone(datetime.UTC).replace(tzinfo=None).isoformat(timespec="seconds") + "Z"
6 changes: 3 additions & 3 deletions ietf/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,12 +461,12 @@ def test_api_add_session_attendees(self):
self.assertTrue(session.attended_set.filter(person=recman).exists())
self.assertEqual(
session.attended_set.get(person=recman).time,
datetime.datetime(2023, 9, 3, 12, 34, 56, tzinfo=datetime.timezone.utc),
datetime.datetime(2023, 9, 3, 12, 34, 56, tzinfo=datetime.UTC),
)
self.assertTrue(session.attended_set.filter(person=otherperson).exists())
self.assertEqual(
session.attended_set.get(person=otherperson).time,
datetime.datetime(2023, 9, 3, 3, 0, 19, tzinfo=datetime.timezone.utc),
datetime.datetime(2023, 9, 3, 3, 0, 19, tzinfo=datetime.UTC),
)

def test_api_upload_polls_and_chatlog(self):
Expand Down Expand Up @@ -1020,7 +1020,7 @@ def test_api_new_meeting_registration_v2_nomcom(self):
self.assertEqual(volunteer.origin, 'registration')

def test_api_version(self):
DumpInfo.objects.create(date=timezone.datetime(2022,8,31,7,10,1,tzinfo=datetime.timezone.utc), host='testapi.example.com',tz='UTC')
DumpInfo.objects.create(date=timezone.datetime(2022,8,31,7,10,1,tzinfo=datetime.UTC), host='testapi.example.com',tz='UTC')
url = urlreverse('ietf.api.views.version')
r = self.client.get(url)
data = r.json()
Expand Down
2 changes: 1 addition & 1 deletion ietf/bin/aliases-from-json.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def generate_files(records, adest, vdest, postconfirm, vdomain):
vpath = tmppath / "virtual"

with apath.open("w") as afile, vpath.open("w") as vfile:
date = datetime.datetime.now(datetime.timezone.utc)
date = datetime.datetime.now(datetime.UTC)
signature = f"# Generated by {Path(__file__).absolute()} at {date}\n"
afile.write(signature)
vfile.write(signature)
Expand Down
2 changes: 1 addition & 1 deletion ietf/doc/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ def fake_history_obj(self, rev):
elif rev_events.exists():
time = rev_events.first().time
else:
time = datetime.datetime.fromtimestamp(0, datetime.timezone.utc)
time = datetime.datetime.fromtimestamp(0, datetime.UTC)
dh = DocHistory(name=self.name, rev=rev, doc=self, time=time, type=self.type, title=self.title,
stream=self.stream, group=self.group)

Expand Down
2 changes: 1 addition & 1 deletion ietf/doc/templatetags/ballot_icon.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def state_age_colored(doc):
.time
)
except IndexError:
state_datetime = datetime.datetime(1990, 1, 1, tzinfo=datetime.timezone.utc)
state_datetime = datetime.datetime(1990, 1, 1, tzinfo=datetime.UTC)
days = (timezone.now() - state_datetime).days
# loosely based on the Publish Path page at the iesg wiki
if iesg_state == "lc":
Expand Down
4 changes: 2 additions & 2 deletions ietf/doc/tests_draft.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,11 +678,11 @@ def test_in_draft_expire_freeze(self):
datetime.datetime.combine(
ietf_monday - datetime.timedelta(days=1),
datetime.time(0, 0, 0),
tzinfo=datetime.timezone.utc,
tzinfo=datetime.UTC,
)
))
self.assertFalse(in_draft_expire_freeze(
datetime.datetime.combine(ietf_monday, datetime.time(0, 0, 0), tzinfo=datetime.timezone.utc)
datetime.datetime.combine(ietf_monday, datetime.time(0, 0, 0), tzinfo=datetime.UTC)
))

def test_warn_expirable_drafts(self):
Expand Down
2 changes: 1 addition & 1 deletion ietf/doc/tests_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ def test_search_mail_archive(self):
messages = r.json()["messages"]
self.assertEqual(len(messages), 2)

today = date_today(datetime.timezone.utc)
today = date_today(datetime.UTC)

self.assertEqual(messages[0]["url"], "https://www.example.com/testmessage")
self.assertTrue("John Doe" in messages[0]["content"])
Expand Down
2 changes: 1 addition & 1 deletion ietf/doc/tests_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def test_update_action_holders_resets_age(self):
doc = self.doc_in_iesg_state('pub-req')
doc.action_holders.set([self.ad])
dah = doc.documentactionholder_set.get(person=self.ad)
dah.time_added = datetime.datetime(2020, 1, 1, tzinfo=datetime.timezone.utc) # arbitrary date in the past
dah.time_added = datetime.datetime(2020, 1, 1, tzinfo=datetime.UTC) # arbitrary date in the past
dah.save()

right_now = timezone.now()
Expand Down
6 changes: 3 additions & 3 deletions ietf/doc/views_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from ietf.utils.timezone import date_today


epochday = datetime.datetime.utcfromtimestamp(0).date().toordinal()
epochday = datetime.datetime.fromtimestamp(0, datetime.UTC).date().toordinal()


def dt(s):
Expand All @@ -35,13 +35,13 @@ def model_to_timeline_data(model, field='time', **kwargs):
assert field in [ f.name for f in model._meta.get_fields() ]

objects = ( model.objects.filter(**kwargs)
.annotate(date=TruncDate(field, tzinfo=datetime.timezone.utc))
.annotate(date=TruncDate(field, tzinfo=datetime.UTC))
.order_by('date')
.values('date')
.annotate(count=Count('id')))
if objects.exists():
obj_list = list(objects)
today = date_today(datetime.timezone.utc)
today = date_today(datetime.UTC)
if not obj_list[-1]['date'] == today:
obj_list += [ {'date': today, 'count': 0} ]
data = [ ((e['date'].toordinal()-epochday)*1000*60*60*24, e['count']) for e in obj_list ]
Expand Down
2 changes: 1 addition & 1 deletion ietf/group/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ def meetings(request, acronym, group_type=None):
cutoff_date = revsub_dates_by_meeting[s.meeting.pk]
else:
cutoff_date = s.meeting.date + datetime.timedelta(days=s.meeting.submission_correction_day_offset)
s.cached_is_cutoff = date_today(datetime.timezone.utc) > cutoff_date
s.cached_is_cutoff = date_today(datetime.UTC) > cutoff_date

future, in_progress, recent, past = group_sessions(sessions)

Expand Down
4 changes: 2 additions & 2 deletions ietf/idindex/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def active_drafts_index_by_group(extra_values=()):
groups = [g for g in groups_dict.values() if hasattr(g, "active_drafts")]
groups.sort(key=lambda g: g.acronym)

fallback_time = datetime.datetime(1950, 1, 1, tzinfo=datetime.timezone.utc)
fallback_time = datetime.datetime(1950, 1, 1, tzinfo=datetime.UTC)
for g in groups:
g.active_drafts.sort(key=lambda d: d.get("initial_rev_time", fallback_time))

Expand All @@ -302,6 +302,6 @@ def id_index_txt(with_abstracts=False):

return render_to_string("idindex/id_index.txt", {
'groups': groups,
'time': timezone.now().astimezone(datetime.timezone.utc).strftime("%Y-%m-%d %H:%M:%S %Z"),
'time': timezone.now().astimezone(datetime.UTC).strftime("%Y-%m-%d %H:%M:%S %Z"),
'with_abstracts': with_abstracts,
})
2 changes: 1 addition & 1 deletion ietf/iesg/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def agenda_json(request, date=None):

res = {
"telechat-date": str(data["date"]),
"as-of": str(datetime.datetime.utcnow()),
"as-of": str(datetime.datetime.now(datetime.UTC)),
"page-counts": telechat_page_count(date=get_agenda_date(date))._asdict(),
"sections": {},
}
Expand Down
2 changes: 1 addition & 1 deletion ietf/ietfauth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def confirm_password_reset(request, auth):
password = data['password']
last_login = None
if data['last_login']:
last_login = datetime.datetime.fromtimestamp(data['last_login'], datetime.timezone.utc)
last_login = datetime.datetime.fromtimestamp(data['last_login'], datetime.UTC)
except django.core.signing.BadSignature:
raise Http404("Invalid or expired auth")

Expand Down
4 changes: 2 additions & 2 deletions ietf/ipr/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ def utc_from_string(s):
if date is None:
return None
elif is_aware(date):
return date.astimezone(datetime.timezone.utc)
return date.astimezone(datetime.UTC)
else:
return date.replace(tzinfo=datetime.timezone.utc)
return date.replace(tzinfo=datetime.UTC)

# ----------------------------------------------------------------
# Email Functions
Expand Down
14 changes: 7 additions & 7 deletions ietf/ipr/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ def ipr_rfc_number(disclosureDate, thirdPartyDisclosureFlag):

# RFC publication date comes from the RFC Editor announcement
ipr_rfc_pub_datetime = {
1310 : datetime.datetime(1992, 3, 13, 0, 0, tzinfo=datetime.timezone.utc),
1802 : datetime.datetime(1994, 3, 23, 0, 0, tzinfo=datetime.timezone.utc),
2026 : datetime.datetime(1996, 10, 29, 0, 0, tzinfo=datetime.timezone.utc),
3668 : datetime.datetime(2004, 2, 18, 0, 0, tzinfo=datetime.timezone.utc),
3979 : datetime.datetime(2005, 3, 2, 2, 23, tzinfo=datetime.timezone.utc),
4879 : datetime.datetime(2007, 4, 10, 18, 21, tzinfo=datetime.timezone.utc),
8179 : datetime.datetime(2017, 5, 31, 23, 1, tzinfo=datetime.timezone.utc),
1310 : datetime.datetime(1992, 3, 13, 0, 0, tzinfo=datetime.UTC),
1802 : datetime.datetime(1994, 3, 23, 0, 0, tzinfo=datetime.UTC),
2026 : datetime.datetime(1996, 10, 29, 0, 0, tzinfo=datetime.UTC),
3668 : datetime.datetime(2004, 2, 18, 0, 0, tzinfo=datetime.UTC),
3979 : datetime.datetime(2005, 3, 2, 2, 23, tzinfo=datetime.UTC),
4879 : datetime.datetime(2007, 4, 10, 18, 21, tzinfo=datetime.UTC),
8179 : datetime.datetime(2017, 5, 31, 23, 1, tzinfo=datetime.UTC),
}

if disclosureDate < ipr_rfc_pub_datetime[1310]:
Expand Down
8 changes: 4 additions & 4 deletions ietf/liaisons/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ def test_add_incoming_liaison(self):
from_groups = [ str(g.pk) for g in Group.objects.filter(type="sdo") ]
to_group = Group.objects.get(acronym="mars")
submitter = Person.objects.get(user__username="marschairman")
today = date_today(datetime.timezone.utc)
today = date_today(datetime.UTC)
related_liaison = liaison
r = self.client.post(url,
dict(from_groups=from_groups,
Expand Down Expand Up @@ -800,7 +800,7 @@ def test_add_outgoing_liaison(self):
from_group = Group.objects.get(acronym="mars")
to_group = Group.objects.filter(type="sdo")[0]
submitter = Person.objects.get(user__username="marschairman")
today = date_today(datetime.timezone.utc)
today = date_today(datetime.UTC)
related_liaison = liaison
r = self.client.post(url,
dict(from_groups=str(from_group.pk),
Expand Down Expand Up @@ -870,7 +870,7 @@ def test_add_outgoing_liaison_unapproved_post_only(self):
from_group = Group.objects.get(acronym="mars")
to_group = Group.objects.filter(type="sdo")[0]
submitter = Person.objects.get(user__username="marschairman")
today = date_today(datetime.timezone.utc)
today = date_today(datetime.UTC)
r = self.client.post(url,
dict(from_groups=str(from_group.pk),
from_contact=submitter.email_address(),
Expand Down Expand Up @@ -1054,7 +1054,7 @@ def test_search(self):
LiaisonStatementEventFactory(type_id='posted', statement__body="Has recently in its body",statement__from_groups=[GroupFactory(type_id='sdo',acronym='ulm'),])
# Statement 2
s2 = LiaisonStatementEventFactory(type_id='posted', statement__body="That word does not occur here", statement__title="Nor does it occur here")
s2.time=datetime.datetime(2010, 1, 1, tzinfo=datetime.timezone.utc)
s2.time=datetime.datetime(2010, 1, 1, tzinfo=datetime.UTC)
s2.save()

# test list only, no search filters
Expand Down
6 changes: 3 additions & 3 deletions ietf/meeting/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def get_00_cutoff(self):
cutoff_date = importantdate.date
else:
cutoff_date = self.date + datetime.timedelta(days=ImportantDateName.objects.get(slug='idcutoff').default_offset_days)
cutoff_time = datetime_from_date(cutoff_date, datetime.timezone.utc) + self.idsubmit_cutoff_time_utc
cutoff_time = datetime_from_date(cutoff_date, datetime.UTC) + self.idsubmit_cutoff_time_utc
return cutoff_time

def get_01_cutoff(self):
Expand All @@ -157,7 +157,7 @@ def get_01_cutoff(self):
cutoff_date = importantdate.date
else:
cutoff_date = self.date + datetime.timedelta(days=ImportantDateName.objects.get(slug='idcutoff').default_offset_days)
cutoff_time = datetime_from_date(cutoff_date, datetime.timezone.utc) + self.idsubmit_cutoff_time_utc
cutoff_time = datetime_from_date(cutoff_date, datetime.UTC) + self.idsubmit_cutoff_time_utc
return cutoff_time

def get_reopen_time(self):
Expand Down Expand Up @@ -1168,7 +1168,7 @@ def can_manage_materials(self, user):
return can_manage_materials(user,self.group)

def is_material_submission_cutoff(self):
return date_today(datetime.timezone.utc) > self.meeting.get_submission_correction_date()
return date_today(datetime.UTC) > self.meeting.get_submission_correction_date()

def joint_with_groups_acronyms(self):
return [group.acronym for group in self.joint_with_groups.all()]
Expand Down
2 changes: 1 addition & 1 deletion ietf/meeting/tests_js.py
Original file line number Diff line number Diff line change
Expand Up @@ -1576,7 +1576,7 @@ def test_delete_timeslot_cancel(self):

def do_delete_time_interval_test(self, cancel=False):
delete_time_local = datetime_from_date(self.meeting.date, self.meeting.tz()).replace(hour=10)
delete_time = delete_time_local.astimezone(datetime.timezone.utc)
delete_time = delete_time_local.astimezone(datetime.UTC)
duration = datetime.timedelta(minutes=60)

delete: [TimeSlot] = TimeSlotFactory.create_batch( # type: ignore[annotation-unchecked]
Expand Down
2 changes: 1 addition & 1 deletion ietf/meeting/tests_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_proceedings_content_refresh_task(self, mock_generate):
meeting127 = MeetingFactory(type_id="ietf", number="127") # 24 * 5 + 7

# Times to be returned
now_utc = datetime.datetime.now(tz=datetime.timezone.utc)
now_utc = datetime.datetime.now(tz=datetime.UTC)
hour_00_utc = now_utc.replace(hour=0)
hour_01_utc = now_utc.replace(hour=1)
hour_07_utc = now_utc.replace(hour=7)
Expand Down
22 changes: 11 additions & 11 deletions ietf/meeting/tests_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,11 @@ def test_meeting_agenda(self):
self.assertContains(r, session.group.parent.acronym.upper())
self.assertContains(r, slot.location.name)
self.assertContains(r, "{}-{}".format(
slot.time.astimezone(datetime.timezone.utc).strftime("%H%M"),
(slot.time + slot.duration).astimezone(datetime.timezone.utc).strftime("%H%M"),
slot.time.astimezone(datetime.UTC).strftime("%H%M"),
(slot.time + slot.duration).astimezone(datetime.UTC).strftime("%H%M"),
))
self.assertContains(r, "shown in UTC")
updated = meeting.updated().astimezone(datetime.timezone.utc).strftime("%Y-%m-%d %H:%M:%S %Z")
updated = meeting.updated().astimezone(datetime.UTC).strftime("%Y-%m-%d %H:%M:%S %Z")
self.assertContains(r, f"Updated {updated}")

# text, invalid updated (none)
Expand Down Expand Up @@ -369,8 +369,8 @@ def test_meeting_agenda(self):
self.assertContains(r, session.group.parent.acronym.upper())
self.assertContains(r, slot.location.name)
self.assertContains(r, registration_text)
start_time = slot.time.astimezone(datetime.timezone.utc)
end_time = slot.end_time().astimezone(datetime.timezone.utc)
start_time = slot.time.astimezone(datetime.UTC)
end_time = slot.end_time().astimezone(datetime.UTC)
self.assertContains(r, '"{}","{}","{}"'.format(
start_time.strftime("%Y-%m-%d"),
start_time.strftime("%H%M"),
Expand Down Expand Up @@ -1029,7 +1029,7 @@ def test_important_dates_ical(self):

updated = meeting.updated()
self.assertIsNotNone(updated)
expected_updated = updated.astimezone(datetime.timezone.utc).strftime("%Y%m%dT%H%M%SZ")
expected_updated = updated.astimezone(datetime.UTC).strftime("%Y%m%dT%H%M%SZ")
self.assertContains(r, f"DTSTAMP:{expected_updated}")
dtstamps_count = r.content.decode("utf-8").count(f"DTSTAMP:{expected_updated}")
self.assertEqual(dtstamps_count, meeting.importantdate_set.count())
Expand Down Expand Up @@ -2105,8 +2105,8 @@ def test_editor_time_zone(self):
# strftime() does not seem to support hours without leading 0, so do this manually
time_label_string = f'{ts_start.hour:d}:{ts_start.minute:02d} - {ts_end.hour:d}:{ts_end.minute:02d}'
self.assertIn(time_label_string, time_label.text())
self.assertEqual(time_label.attr('data-start'), ts_start.astimezone(datetime.timezone.utc).isoformat())
self.assertEqual(time_label.attr('data-end'), ts_end.astimezone(datetime.timezone.utc).isoformat())
self.assertEqual(time_label.attr('data-start'), ts_start.astimezone(datetime.UTC).isoformat())
self.assertEqual(time_label.attr('data-end'), ts_end.astimezone(datetime.UTC).isoformat())

ts_swap = time_label.find('.swap-timeslot-col')
origin_label = ts_swap.attr('data-origin-label')
Expand All @@ -2117,8 +2117,8 @@ def test_editor_time_zone(self):

timeslot_elt = pq(f'#timeslot{timeslot.pk}')
self.assertEqual(len(timeslot_elt), 1)
self.assertEqual(timeslot_elt.attr('data-start'), ts_start.astimezone(datetime.timezone.utc).isoformat())
self.assertEqual(timeslot_elt.attr('data-end'), ts_end.astimezone(datetime.timezone.utc).isoformat())
self.assertEqual(timeslot_elt.attr('data-start'), ts_start.astimezone(datetime.UTC).isoformat())
self.assertEqual(timeslot_elt.attr('data-end'), ts_end.astimezone(datetime.UTC).isoformat())

timeslot_label = pq(f'#timeslot{timeslot.pk} .time-label')
self.assertEqual(len(timeslot_label), 1)
Expand Down Expand Up @@ -5221,7 +5221,7 @@ def test_upcoming_ical(self):

updated = meeting.updated()
self.assertIsNotNone(updated)
expected_updated = updated.astimezone(datetime.timezone.utc).strftime("%Y%m%dT%H%M%SZ")
expected_updated = updated.astimezone(datetime.UTC).strftime("%Y%m%dT%H%M%SZ")
self.assertContains(r, f"DTSTAMP:{expected_updated}")

# With default cached_updated, 1970-01-01
Expand Down
6 changes: 3 additions & 3 deletions ietf/meeting/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def materials(request, num=None):
begin_date = meeting.get_submission_start_date()
cut_off_date = meeting.get_submission_cut_off_date()
cor_cut_off_date = meeting.get_submission_correction_date()
today_utc = date_today(datetime.timezone.utc)
today_utc = date_today(datetime.UTC)
old = timezone.now() - datetime.timedelta(days=1)
if settings.SERVER_MODE != 'production' and '_testoverride' in request.GET:
pass
Expand Down Expand Up @@ -1914,7 +1914,7 @@ def slides_field(item):

write_row(headings)

tz = datetime.timezone.utc if utc else schedule.meeting.tz()
tz = datetime.UTC if utc else schedule.meeting.tz()
for item in filtered_assignments:
row = []
row.append(item.timeslot.time.astimezone(tz).strftime("%Y-%m-%d"))
Expand Down Expand Up @@ -2695,7 +2695,7 @@ def session_attendance(request, session_id, num):
raise Http404("Bluesheets not found")

cor_cut_off_date = session.meeting.get_submission_correction_date()
today_utc = date_today(datetime.timezone.utc)
today_utc = date_today(datetime.UTC)
was_there = False
can_add = False
if request.user.is_authenticated:
Expand Down
2 changes: 1 addition & 1 deletion ietf/nomcom/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2927,7 +2927,7 @@ def test_decorate_volunteers_with_qualifications(self):
elig_date.year - 3,
elig_date.month,
28 if elig_date.month == 2 and elig_date.day == 29 else elig_date.day,
tzinfo=datetime.timezone.utc,
tzinfo=datetime.UTC,
)
)
nomcom.volunteer_set.create(person=author_person)
Expand Down
Loading