示例#1
0
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)
示例#2
0
文件: helpers.py 项目: tbalaz/test
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)