mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Downgrade tzlocal-2.1
This commit is contained in:
parent
5d46655507
commit
ea398827cb
4 changed files with 33 additions and 46 deletions
|
@ -1,18 +1,13 @@
|
|||
import sys
|
||||
|
||||
try:
|
||||
import _winreg as winreg
|
||||
except ImportError:
|
||||
import winreg
|
||||
|
||||
import pytz
|
||||
|
||||
from tzlocal.windows_tz import win_tz
|
||||
from tzlocal import utils
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
|
||||
else:
|
||||
from backports.zoneinfo import ZoneInfo, ZoneInfoNotFoundError
|
||||
|
||||
_cache_tz = None
|
||||
|
||||
|
||||
|
@ -86,7 +81,7 @@ def get_localzone_name():
|
|||
|
||||
# Return what we have.
|
||||
if timezone is None:
|
||||
raise ZoneInfoNotFoundError(tzkeyname)
|
||||
raise pytz.UnknownTimeZoneError('Can not find timezone ' + tzkeyname)
|
||||
|
||||
return timezone
|
||||
|
||||
|
@ -95,7 +90,7 @@ def get_localzone():
|
|||
"""Returns the zoneinfo-based tzinfo object that matches the Windows-configured timezone."""
|
||||
global _cache_tz
|
||||
if _cache_tz is None:
|
||||
_cache_tz = ZoneInfo(get_localzone_name())
|
||||
_cache_tz = pytz.timezone(get_localzone_name())
|
||||
|
||||
utils.assert_tz_offset(_cache_tz)
|
||||
return _cache_tz
|
||||
|
@ -104,6 +99,6 @@ def get_localzone():
|
|||
def reload_localzone():
|
||||
"""Reload the cached localzone. You need to call this if the timezone has changed."""
|
||||
global _cache_tz
|
||||
_cache_tz = ZoneInfo(get_localzone_name())
|
||||
_cache_tz = pytz.timezone(get_localzone_name())
|
||||
utils.assert_tz_offset(_cache_tz)
|
||||
return _cache_tz
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue