From 3813ca597b3d76538f4d495e5eaf5b649e77adff Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 8 Apr 2012 21:00:56 -0500 Subject: Don't blow up when no mirror status data is available The check here was wrong before; in the case of no mirror log entries the returned value will not be empty, but will contain two empty values. Check the values instead to see if we have valid data available. Signed-off-by: Dan McGee --- mirrors/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mirrors/utils.py b/mirrors/utils.py index 619d5f5c..ddecb095 100644 --- a/mirrors/utils.py +++ b/mirrors/utils.py @@ -108,7 +108,7 @@ def get_mirror_url_for_download(cutoff=default_cutoff): status_data = MirrorLog.objects.filter( check_time__gte=cutoff_time).aggregate( Max('check_time'), Max('last_sync')) - if status_data: + if status_data['check_time__max'] is not None: min_check_time = status_data['check_time__max'] - timedelta(minutes=5) min_sync_time = status_data['last_sync__max'] - timedelta(minutes=30) best_logs = MirrorLog.objects.filter(is_success=True, -- cgit v1.2.3-55-g3dc8