diff options
-rw-r--r-- | lib/toaster/toastermain/settings.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/toaster/toastermain/settings.py b/lib/toaster/toastermain/settings.py index e26ee3c9e..6e9d85d4c 100644 --- a/lib/toaster/toastermain/settings.py +++ b/lib/toaster/toastermain/settings.py @@ -64,7 +64,15 @@ else: for dirpath, dirnames, filenames in os.walk(ZONEINFOPATH): for fn in filenames: filepath = os.path.join(dirpath, fn) - zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = filepath.lstrip(ZONEINFOPATH).strip() + try: + import pytz + from pytz.exceptions import UnknownTimeZoneError + zonename = filepath.lstrip(ZONEINFOPATH).strip() + if pytz.timezone(zonename) is not None: + zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename + except UnknownTimeZoneError, ValueError: + # we expect timezone failures here, just move over + pass TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime').read()).hexdigest()] |