[PATCH 03/14] Add function to get all regions and timezones

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 pyanaconda/localization.py |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/localization.py b/pyanaconda/localization.py
index 75b2864..e5e75a6 100644
--- a/pyanaconda/localization.py
+++ b/pyanaconda/localization.py
@@ -19,7 +19,7 @@
 # Red Hat Author(s): Martin Gracik <mgracik@xxxxxxxxxx>
 #
 
-from collections import defaultdict, deque
+from collections import defaultdict, deque, OrderedDict
 import gettext
 import locale
 import os
@@ -275,7 +275,7 @@ class Language(object):
         print 'set system lang to "%s"' % self.system_lang
 
 
-def get_all_timezones(territory):
+def get_all_territory_timezones(territory):
     if isinstance(territory, LocaleInfo):
         territory = territory.territory
 
@@ -289,8 +289,22 @@ def get_all_timezones(territory):
 
 def get_preferred_timezone(territory):
     try:
-        timezone = get_all_timezones(territory)[0]
+        timezone = get_all_territory_timezones(territory)[0]
     except IndexError:
         timezone = None
 
     return timezone
+
+def get_all_regions_and_timezones():
+    result = OrderedDict()
+
+    for tz in pytz.common_timezones:
+        parts = tz.split("/")
+
+        if parts[0] not in result:
+            result[parts[0]] = set()
+
+        if len(parts) > 1:
+            result[parts[0]].add(parts[1])
+
+    return result
-- 
1.7.4.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux