[Django] #37110: Use `zoneinfo` for validating `TIME_ZONE` setting instead of `Path("/usr/share/zoneinfo")`

6 views
Skip to first unread message

Django

unread,
May 19, 2026, 3:29:26 PM (2 days ago) May 19
to django-...@googlegroups.com
#37110: Use `zoneinfo` for validating `TIME_ZONE` setting instead of
`Path("/usr/share/zoneinfo")`
-----------------------------------------+--------------------------
Reporter: jodizzle | Owner: (none)
Type: Uncategorized | Status: assigned
Component: Uncategorized | Version: dev
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+--------------------------
On my system, I receive failures in the test suite related to the setting
of `TIME_ZONE`, e.g.,
[https://github.com/django/django/blob/3e4e0db66961a48a080ff3ff91f6c0d954261366/tests/settings_tests/tests.py#L338
`test_incorrect_timezone`]. The root issue is that Django
[https://github.com/django/django/blob/3e4e0db66961a48a080ff3ff91f6c0d954261366/django/conf/__init__.py#L281
validates `TIME_ZONE` against a hardcoded "/usr/share/zoneinfo" path]
which does not exist on my system.

Thankfully, Python has standard library support for validating timezones
via the [https://docs.python.org/3/library/zoneinfo.html `zoneinfo`
module]. This module was introduced in Python 3.9, meaning all modern
Django versions should support it's use.

I've attached the patch that fixes my test failures. I can submit a PR if
this ticket is accepted.
--
Ticket URL: <https://code.djangoproject.com/ticket/37110>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 19, 2026, 3:29:42 PM (2 days ago) May 19
to django-...@googlegroups.com
#37110: Use `zoneinfo` for validating `TIME_ZONE` setting instead of
`Path("/usr/share/zoneinfo")`
-------------------------------+--------------------------------------
Reporter: jodizzle | Owner: (none)
Type: Uncategorized | Status: assigned
Component: Uncategorized | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by jodizzle):

* Attachment "zoneinfo-patch.diff" added.

Django

unread,
May 19, 2026, 5:51:41 PM (2 days ago) May 19
to django-...@googlegroups.com
#37110: Use `zoneinfo` for validating `TIME_ZONE` setting instead of
`Path("/usr/share/zoneinfo")`
-------------------------------+--------------------------------------
Reporter: jodizzle | Owner: jodizzle
Type: Uncategorized | Status: assigned
Component: Uncategorized | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by jodizzle):

* owner: (none) => jodizzle

--
Ticket URL: <https://code.djangoproject.com/ticket/37110#comment:1>

Django

unread,
May 19, 2026, 5:55:43 PM (2 days ago) May 19
to django-...@googlegroups.com
#37110: Use `zoneinfo` for validating `TIME_ZONE` setting instead of
`Path("/usr/share/zoneinfo")`
-----------------------------------+--------------------------------------
Reporter: jodizzle | Owner: jodizzle
Type: Uncategorized | Status: assigned
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by jodizzle):

* component: Uncategorized => Testing framework

--
Ticket URL: <https://code.djangoproject.com/ticket/37110#comment:2>

Django

unread,
May 19, 2026, 10:27:57 PM (2 days ago) May 19
to django-...@googlegroups.com
#37110: Use `zoneinfo` for validating `TIME_ZONE` setting instead of
`Path("/usr/share/zoneinfo")`
-----------------------------------+--------------------------------------
Reporter: jodizzle | Owner: jodizzle
Type: Bug | Status: assigned
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by jodizzle):

* type: Uncategorized => Bug

--
Ticket URL: <https://code.djangoproject.com/ticket/37110#comment:3>

Django

unread,
May 20, 2026, 11:21:25 AM (23 hours ago) May 20
to django-...@googlegroups.com
#37110: Use `zoneinfo` for validating `TIME_ZONE` setting instead of
`Path("/usr/share/zoneinfo")`
--------------------------------------+------------------------------------
Reporter: jodizzle | Owner: jodizzle
Type: Cleanup/optimization | Status: assigned
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Sarah Boyce):

* stage: Unreviewed => Accepted
* type: Bug => Cleanup/optimization

Comment:

Refs #3415
Thank you for the suggestion
--
Ticket URL: <https://code.djangoproject.com/ticket/37110#comment:4>
Reply all
Reply to author
Forward
0 new messages