#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.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019e41b6d00f-9eb8cf1c-44bd-4bd6-a1ce-016afeefa5fa-000000%40eu-central-1.amazonses.com.