コード例 #1
0
ファイル: views.py プロジェクト: stfenjobs/PyTune3
def import_starred_stories_from_google_reader(request):
    code = 0
    feed_count = 0
    starred_count = 0
    delayed = False

    if request.user.is_authenticated():
        reader_importer = GoogleReaderImporter(request.user)
        try:
            starred_count = reader_importer.try_import_starred_stories()
        except TimeoutError:
            ProcessReaderStarredImport.delay(request.user.pk)
            feed_count = UserSubscription.objects.filter(
                user=request.user).count()
            logging.user(
                request,
                "~FR~SBGoogle Reader starred stories import took too long, found %s feeds, %s stories. Tasking..."
                % (feed_count, starred_count))
            delayed = True
            code = 2

        feed_count = UserSubscription.objects.filter(user=request.user).count()

    return dict(code=code,
                delayed=delayed,
                feed_count=feed_count,
                starred_count=starred_count)
コード例 #2
0
ファイル: views.py プロジェクト: AlphaCluster/NewsBlur
def import_starred_stories_from_google_reader(request):
    code = 0
    feed_count = 0
    starred_count = 0
    delayed = False
    
    if request.user.is_authenticated():
        reader_importer = GoogleReaderImporter(request.user)
        try:
            starred_count = reader_importer.try_import_starred_stories()
        except TimeoutError:
            ProcessReaderStarredImport.delay(request.user.pk)
            feed_count = UserSubscription.objects.filter(user=request.user).count()
            logging.user(request, "~FR~SBGoogle Reader starred stories import took too long, found %s feeds, %s stories. Tasking..." % (feed_count, starred_count))
            delayed = True
            code = 2
    
        feed_count = UserSubscription.objects.filter(user=request.user).count()
        
    return dict(code=code, delayed=delayed, feed_count=feed_count, starred_count=starred_count)