From 26a85cef17935a3752cd886cf395a2f55b13e860 Mon Sep 17 00:00:00 2001 From: Will Thong Date: Tue, 25 Jul 2023 16:56:52 +0100 Subject: [PATCH] Simplify import process for zoneinfo backport --- pelican/contents.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pelican/contents.py b/pelican/contents.py index 368082d6..b756f92d 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -11,7 +11,7 @@ from urllib.parse import unquote, urljoin, urlparse, urlunparse try: import zoneinfo except ModuleNotFoundError: - import backports.zoneinfo + from backports import zoneinfo from pelican.plugins import signals @@ -127,10 +127,7 @@ class Content: # manage timezone default_timezone = settings.get("TIMEZONE", "UTC") timezone = getattr(self, "timezone", default_timezone) - try: - self.timezone = zoneinfo.ZoneInfo(timezone) - except NameError: - self.timezone = backports.zoneinfo.ZoneInfo(timezone) + self.timezone = zoneinfo.ZoneInfo(timezone) if hasattr(self, 'date'): self.date = set_date_tzinfo(self.date, timezone)