mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Simplify import process for zoneinfo backport
This commit is contained in:
parent
9eb3b18269
commit
26a85cef17
1 changed files with 2 additions and 5 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue