def get_city_name_from_tzdata(self, tz): city = tz.split('/', 1)[1] # Iterate through tzdata's regions, check each region's tz list for # our city. Like get_country_name, this is inefficient (we could # cache this info), but we don't need to run this often. try: areas = self.choices_untranslated('tzdata/Areas') for area in areas: zones = self.choices_display_map('tzdata/Zones/%s' % area) for name, code in zones.items(): if code == city: return name except debconf.DebconfError, e: print "Couldn't get city name for %s: %s" % (tz, e)
def get_city_name_from_tzdata(self, tz): city = tz.split("/", 1)[1] # Iterate through tzdata's regions, check each region's tz list for # our city. Like get_country_name, this is inefficient (we could # cache this info), but we don't need to run this often. try: areas = self.choices_untranslated("tzdata/Areas") for area in areas: zones = self.choices_display_map("tzdata/Zones/%s" % area) for name, code in zones.items(): if code == city: return name except debconf.DebconfError, e: print "Couldn't get city name for %s: %s" % (tz, e)