示例#1
0
def reload_wiki_traffic_stats():
    transaction.enter_transaction_management()
    transaction.managed(True)

    for period, _ in PERIODS:
        try:
            WikiDocumentVisits.reload_period_from_json(
                     period, WikiDocumentVisits.json_for(period))
        except:
            transaction.rollback()
            raise
        else:
            transaction.commit()

    # Nice but not necessary when the process is about to exit:
    transaction.leave_transaction_management()
示例#2
0
文件: cron.py 项目: ibai/kitsune
def reload_wiki_traffic_stats():
    transaction.enter_transaction_management()
    transaction.managed(True)

    for period, _ in PERIODS:
        try:
            WikiDocumentVisits.reload_period_from_json(
                period, WikiDocumentVisits.json_for(period))
        except:
            transaction.rollback()
            raise
        else:
            transaction.commit()

    # Nice but not necessary when the process is about to exit:
    transaction.leave_transaction_management()