Fix sort timezones

master3.3
Mike Hiretsky 12 years ago
parent 2131727a8e
commit 5f4baafb5c

@ -228,14 +228,17 @@ class VariableOsInstallClockTimezone(LocaleVariable):
"Asia/Vladivostok", "Pacific/Guam", "Australia/Melbourne",
"Australia/Hobart", "Asia/Magadan", "Asia/Kamchatka",
"Pacific/Auckland", "Etc/GMT-13"]
def sortkey(s):
tz = timezone(s)
strinfo = tz.localize(datetime.now()).strftime('%z')
return (int(strinfo[:3]),int("%s%s"%(strinfo[0],strinfo[-2:])))
try:
lang = self.Get('os_install_locale_lang').split('_')[1]
nativeTZ = map(lambda x:x.encode('utf-8'),
country_timezones[lang])
source = nativeTZ + ["---"] + \
sorted(filter(lambda x:not x in nativeTZ,source),
key=lambda x:timezone(x)._utcoffset.total_seconds(),
reverse=True)
key=sortkey)
except (KeyError,IndexError) as e:
pass
return list(self.generateComments(source))

Loading…
Cancel
Save