예제 #1
0
def request_for_update(request):
  """Trigger the collection of news from all known feeds and the cleanup
  of all references that have never been saved (past an arbitrary
  delay).
  """
  delete_old_references(datetime.now(timezone.utc)-NEWS_TIME_THRESHOLD)
  collect_news_from_feeds()
  if settings.DEMO:
    # keep only a short number of refs (the most recent) to avoid bloating the demo
    with transaction.commit_on_success():
      for ref in list(Reference.objects\
                      .filter(save_count=0)\
                      .order_by("-pub_date")[MAX_ITEMS_PER_PAGE:]):
        ref.delete()
  return HttpResponseRedirect(reverse("wom_user.views.home"))
예제 #2
0
def delete_old_references_regularly():
    delete_old_references(datetime.now(timezone.utc) - NEWS_TIME_THRESHOLD)
예제 #3
0
def delete_old_references_regularly():
  delete_old_references(datetime.now(timezone.utc)-NEWS_TIME_THRESHOLD)
예제 #4
0
def request_for_cleanup(request):
  """Trigger a cleanup of all references that have never been saved
  (past an arbitrary delay).
  """
  delete_old_references(datetime.now(timezone.utc)-NEWS_TIME_THRESHOLD)
  return HttpResponseRedirect(reverse("wom_user.views.home"))