From d009cd0b5c4ba018681942daa59452fe2b1a42c2 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 21 Oct 2014 20:33:12 -0500 Subject: Fix error when viewing mirror with no active URLs Signed-off-by: Dan McGee --- mirrors/utils.py | 1 + mirrors/views.py | 2 ++ 2 files changed, 3 insertions(+) (limited to 'mirrors') diff --git a/mirrors/utils.py b/mirrors/utils.py index 51daf50e..930adb8d 100644 --- a/mirrors/utils.py +++ b/mirrors/utils.py @@ -141,6 +141,7 @@ def get_mirror_statuses(cutoff=DEFAULT_CUTOFF, mirror_id=None, show_all=False): else: check_frequency = None else: + urls = [] last_check = None num_checks = 0 check_frequency = None diff --git a/mirrors/views.py b/mirrors/views.py index c2736da8..cffafbf5 100644 --- a/mirrors/views.py +++ b/mirrors/views.py @@ -193,6 +193,8 @@ def mirror_details(request, name): def mirror_details_json(request, name): authorized = request.user.is_authenticated() mirror = get_object_or_404(Mirror, name=name) + if not authorized and (not mirror.public or not mirror.active): + raise Http404 status_info = get_mirror_statuses(mirror_id=mirror.id, show_all=authorized) data = status_info.copy() -- cgit v1.2.3