def drilldown_key( slug, obj_type ): label = u'' try: slugs = slug.split('/') if len(slugs) == 1: if _search_drilldown_cache.has_object(obj_type, slug): label = _search_drilldown_cache.get_object(obj_type, slug)['data']['label'] label = label.capitalize() else: label = slug.capitalize() else: if obj_type in ('admin3','admin2'): label = _search_drilldown_cache.get_object(obj_type, slugs[0])['data']['label'] elif obj_type in ('label','slug'): label = _search_drilldown_cache.get_object(obj_type, slugs[1])['data']['label'] else: label = slug.capitalize() label = label.capitalize() except: label = slug.capitalize() if _search_drilldown_cache.has_key(slug): label += ' ('+_search_drilldown_cache.get_key_data(slug)[obj_type]+')' return label
def drilldown_key_label( slug, obj_type ): try: slugs = slug.split('/') if len(slugs) == 1: if _search_drilldown_cache.has_object(obj_type, slug): label = _search_drilldown_cache.get_object(obj_type, slug)['data']['label'] return label.capitalize() else: return slug.capitalize() else: if obj_type in ('admin3','admin2'): label = _search_drilldown_cache.get_object(obj_type, slugs[0])['data']['label'] elif obj_type in ('label','slug'): label = _search_drilldown_cache.get_object(obj_type, slugs[1])['data']['label'] else: return slug.capitalize() return label.capitalize() except: return slug.capitalize()