本文整理汇总了Python中dashboards.models.WikiDocumentVisits.reload_period_from_analytics方法的典型用法代码示例。如果您正苦于以下问题:Python WikiDocumentVisits.reload_period_from_analytics方法的具体用法?Python WikiDocumentVisits.reload_period_from_analytics怎么用?Python WikiDocumentVisits.reload_period_from_analytics使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dashboards.models.WikiDocumentVisits
的用法示例。
在下文中一共展示了WikiDocumentVisits.reload_period_from_analytics方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: reload_wiki_traffic_stats
# 需要导入模块: from dashboards.models import WikiDocumentVisits [as 别名]
# 或者: from dashboards.models.WikiDocumentVisits import reload_period_from_analytics [as 别名]
def reload_wiki_traffic_stats():
transaction.enter_transaction_management()
transaction.managed(True)
for period, _ in PERIODS:
try:
WikiDocumentVisits.reload_period_from_analytics(period)
except:
transaction.rollback()
raise
else:
transaction.commit()
# Nice but not necessary when the process is about to exit:
transaction.leave_transaction_management()
示例2: test_visit_count_from_analytics
# 需要导入模块: from dashboards.models import WikiDocumentVisits [as 别名]
# 或者: from dashboards.models.WikiDocumentVisits import reload_period_from_analytics [as 别名]
def test_visit_count_from_analytics(self, _build_request):
"""Verify stored visit counts from mocked analytics data.
It has some nasty non-ASCII chars in it.
"""
execute = _build_request.return_value.get.return_value.execute
execute.return_value = PAGEVIEWS_BY_DOCUMENT_RESPONSE
d1 = revision(document=document(slug='hellỗ', save=True),
is_approved=True, save=True).document
d2 = revision(document=document(slug='there', save=True),
is_approved=True, save=True).document
WikiDocumentVisits.reload_period_from_analytics(LAST_7_DAYS)
eq_(2, WikiDocumentVisits.objects.count())
wdv1 = WikiDocumentVisits.objects.get(document=d1)
eq_(27, wdv1.visits)
eq_(LAST_7_DAYS, wdv1.period)
wdv2 = WikiDocumentVisits.objects.get(document=d2)
eq_(LAST_7_DAYS, wdv2.period)
示例3: reload_wiki_traffic_stats
# 需要导入模块: from dashboards.models import WikiDocumentVisits [as 别名]
# 或者: from dashboards.models.WikiDocumentVisits import reload_period_from_analytics [as 别名]
def reload_wiki_traffic_stats():
for period, _ in PERIODS:
WikiDocumentVisits.reload_period_from_analytics(period)