From b484cf013680b325ab20be42a0e12c4530fe5360 Mon Sep 17 00:00:00 2001 From: RitvikSardana <65544983+RitvikSardana@users.noreply.github.com> Date: Fri, 24 Apr 2026 14:06:40 +0530 Subject: [PATCH] fix: pytz to filter out deprecated timezones (#38751) --- frappe/core/doctype/user/user.py | 11 ++++++++--- frappe/patches.txt | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/frappe/core/doctype/user/user.py b/frappe/core/doctype/user/user.py index f31b400e32..3e742c3e22 100644 --- a/frappe/core/doctype/user/user.py +++ b/frappe/core/doctype/user/user.py @@ -4,7 +4,7 @@ import re from collections.abc import Iterable from datetime import timedelta -from functools import cached_property +from functools import cached_property, lru_cache from typing import Any import frappe @@ -894,9 +894,14 @@ class User(Document): @frappe.whitelist() def get_timezones(): - import zoneinfo + return {"timezones": _get_timezones()} - return {"timezones": zoneinfo.available_timezones()} + +@lru_cache(maxsize=1) +def _get_timezones(): + import pytz + + return sorted(pytz.common_timezones) @frappe.whitelist() diff --git a/frappe/patches.txt b/frappe/patches.txt index add082e78d..3537b55044 100644 --- a/frappe/patches.txt +++ b/frappe/patches.txt @@ -260,4 +260,4 @@ execute:from frappe.email.doctype.notification.notification import install_notif execute:frappe.db.set_value("Email Account", {}, "add_x_original_from", 1) frappe.patches.v16_0.fix_myanmar_language_name execute:frappe.db.set_value("Email Account", {}, "add_reply_to_header", 1) -frappe.patches.v16_0.set_reply_to_header +frappe.patches.v16_0.set_reply_to_header \ No newline at end of file