def location_country(location): try: key = tag_key(location) value = kv.lrange(place_key(key), 0, -1) return ensure_list(value) except KeyError: return []
def __init__(self, label, span, countries): super(LocationResult, self).__init__(label, span, countries) if self.key is not None: try: value = kv.lrange(place_key(self.key), 0, -1) self.countries = ensure_list(value) except KeyError: pass