def popular_datasets(count=10): import random publisher = None publishers = _get_publishers(30) total = len(publishers) while not publisher or not datasets: rand = random.randrange(0, total) publisher = publishers[rand][0] if not publisher.state == 'active': publisher = None continue datasets = _datasets_for_publisher(publisher, 10)[:count] ctx = {'datasets': datasets, 'publisher': publisher} return base.render_snippet('ga_report/ga_popular_datasets.html', **ctx)
def popular_datasets(count=10): import random publisher = None publishers = _get_publishers(30) total = len(publishers) while not publisher or not datasets: rand = random.randrange(0, total) publisher = publishers[rand][0] if not publisher.state == "active": publisher = None continue datasets = _datasets_for_publisher(publisher, 10)[:count] ctx = {"datasets": datasets, "publisher": publisher} return base.render_snippet("ga_report/ga_popular_datasets.html", **ctx)