def localize_categories(categories, categories2): ''' Return a localized and sorted listing ''' for category in categories: for key, val in list(category.items()): if key == 'name': category[key] = localize_from_data(val, categories2) return sorted(categories, key=lambda x: x.get('name'))
def localize_features(featured): ''' Return a localized and sorted listing ''' from copy import deepcopy features = deepcopy(featured) for feature in features: for key, val in list(feature.items()): if key == 'name': feature[key] = localize_from_data(val, featured) return sorted(features, key=lambda x: x.get('name'))