diff options
author | Vratislav Podzimek <vpodzime@redhat.com> | 2012-11-01 22:40:34 +0100 |
---|---|---|
committer | Vratislav Podzimek <vpodzime@redhat.com> | 2012-11-06 10:18:43 +0100 |
commit | 88d9dd82a638dcb267936f0482de79d47dc8b7a9 (patch) | |
tree | 9a4182069c6c60d94f306d895c1e8ff46ea28556 /pyanaconda/timezone.py | |
parent | 4a53beafb8a1a4264844d98445d385b5cd4cd9ea (diff) | |
download | anaconda-88d9dd82a638dcb267936f0482de79d47dc8b7a9.tar.gz anaconda-88d9dd82a638dcb267936f0482de79d47dc8b7a9.tar.xz anaconda-88d9dd82a638dcb267936f0482de79d47dc8b7a9.zip |
Add UTC and GMT-X timezones (#863199)
It makes sense to set timezone to UTC or GMT-XX. Please mind that
"Etc" category doesn't come from my mind, that's how these timezones
are defined in the /usr/share/zoneinfo tree.
Diffstat (limited to 'pyanaconda/timezone.py')
-rw-r--r-- | pyanaconda/timezone.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/pyanaconda/timezone.py b/pyanaconda/timezone.py index 61f7e756a..f08f0c42f 100644 --- a/pyanaconda/timezone.py +++ b/pyanaconda/timezone.py @@ -34,6 +34,15 @@ from pyanaconda import iutil import logging log = logging.getLogger("anaconda") +# The following zones are not in pytz.common_timezones and +# Etc category in pytz.all_timezones includes some more, +# however confusing ones (like UCT, GMT+0, GMT-0,...) +ETC_ZONES = ['GMT+1', 'GMT+2', 'GMT+3', 'GMT+4', 'GMT+5', 'GMT+6', 'GMT+7', + 'GMT+8', 'GMT+9', 'GMT+10', 'GMT+11', 'GMT+12', + 'GMT-1', 'GMT-2', 'GMT-3', 'GMT-4', 'GMT-5', 'GMT-6', 'GMT-7', + 'GMT-8', 'GMT-9', 'GMT-10', 'GMT-11', 'GMT-12', 'GMT-13', + 'GMT-14', 'UTC', 'GMT'] + class TimezoneConfigError(Exception): """Exception class for timezone configuration related problems""" pass @@ -163,6 +172,7 @@ def get_all_regions_and_timezones(): result[parts[0]] = set() result[parts[0]].add(parts[1]) + result["Etc"] = set(ETC_ZONES) return result def is_valid_timezone(timezone): @@ -174,5 +184,7 @@ def is_valid_timezone(timezone): """ - return timezone in pytz.common_timezones + etc_zones = ["Etc/" + zone for zone in ETC_ZONES] + + return timezone in pytz.common_timezones + etc_zones |