From 05f26e3abcd00576c97c9566b2fe33e5085f0601 Mon Sep 17 00:00:00 2001 From: Boris Bobrov Date: Fri, 5 Feb 2016 05:38:18 +0300 Subject: [PATCH] Do not calculate processing info for anonymous user --- mediagoblin/plugins/processing_info/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mediagoblin/plugins/processing_info/__init__.py b/mediagoblin/plugins/processing_info/__init__.py index e5ce0a1c..fb824765 100644 --- a/mediagoblin/plugins/processing_info/__init__.py +++ b/mediagoblin/plugins/processing_info/__init__.py @@ -35,12 +35,13 @@ def setup_plugin(): def make_stats(context): request = context['request'] user = request.user - num_queued = MediaEntry.query.filter_by( - actor=user.id, state=u'processing').count() - context['num_queued'] = num_queued - num_failed = MediaEntry.query.filter_by( - actor=user.id, state=u'failed').count() - context['num_failed'] = num_failed + if user: + num_queued = MediaEntry.query.filter_by( + actor=user.id, state=u'processing').count() + context['num_queued'] = num_queued + num_failed = MediaEntry.query.filter_by( + actor=user.id, state=u'failed').count() + context['num_failed'] = num_failed return context -- 2.25.1