FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 03-30-2012, 07:55 PM
Vratislav Podzimek
 
Default Add function to get all regions and timezones

---
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@redhat.com>
#

-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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 04-02-2012, 03:13 PM
Vratislav Podzimek
 
Default Add function to get all regions and timezones

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

diff --git a/pyanaconda/localization.py b/pyanaconda/localization.py
index 75b2864..de122ed 100644
--- a/pyanaconda/localization.py
+++ b/pyanaconda/localization.py
@@ -19,7 +19,7 @@
# Red Hat Author(s): Martin Gracik <mgracik@redhat.com>
#

-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,21 @@ 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("/", 1)
+
+ if len(parts) > 1:
+ if parts[0] not in result:
+ result[parts[0]] = set()
+ result[parts[0]].add(parts[1])
+
+ return result
--
1.7.4.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 04-02-2012, 03:30 PM
Chris Lumens
 
Default Add function to get all regions and timezones

> pyanaconda/localization.py | 19 ++++++++++++++++---
> 1 files changed, 16 insertions(+), 3 deletions(-)

Could this be merged with the previous patch?

- Chris

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

Thread Tools




All times are GMT. The time now is 11:14 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org