1
0
Fork 0
forked from github/pelican

Replace pytz dependency in tests (#3165)

This commit is contained in:
Will Thong 2023-08-15 19:07:39 +01:00 committed by GitHub
commit 2eeff62fd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 16 deletions

View file

@ -9,9 +9,9 @@ from html import unescape
from urllib.parse import unquote, urljoin, urlparse, urlunparse
try:
import zoneinfo
from zoneinfo import ZoneInfo
except ModuleNotFoundError:
from backports import zoneinfo
from backports.zoneinfo import ZoneInfo
from pelican.plugins import signals
@ -127,7 +127,7 @@ class Content:
# manage timezone
default_timezone = settings.get("TIMEZONE", "UTC")
timezone = getattr(self, "timezone", default_timezone)
self.timezone = zoneinfo.ZoneInfo(timezone)
self.timezone = ZoneInfo(timezone)
if hasattr(self, 'date'):
self.date = set_date_tzinfo(self.date, timezone)