Skip to content

Switch from pytz to zoneinfo

Django 4.0 switches from pytz to the bundled zoneinfo: https://docs.djangoproject.com/en/4.1/releases/4.0/#zoneinfo-default-timezone-implementation and stops installing pytz. This changeset replaces pytz with (backports.)zoneinfo in hyperkitty.

As far as I can see, both django-mailman3 and hyperkitty create a table with all possible timezones, using the same code:

import pytz
TIMEZONES = sorted([ (tz, tz) for tz in pytz.common_timezones ])

now

try:
    import zoneinfo
except ImportError:
    from backports import zoneinfo
 
TIMEZONES = sorted([(tz, tz) for tz in zoneinfo.available_timezones()])

In both cases the list of timezones is added to the Profile model.

I do not know why, but for me it seems that the same data is presented twice in the database, which is kind of suboptimal.

Merge request reports