summaryrefslogtreecommitdiffstats
path: root/mirrors
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-03-28 18:26:55 -0500
committerDan McGee <dan@archlinux.org>2011-03-28 18:26:55 -0500
commit5df255a5b61117f5e48a638b11470a092b8326c6 (patch)
treed41de4c342fab284370907f9f5f68cc7d140b6b7 /mirrors
parent5f0916a8df8fa3498b7ec3f395e8c3ed49139b31 (diff)
downloadarchweb-5df255a5b61117f5e48a638b11470a092b8326c6.tar.gz
archweb-5df255a5b61117f5e48a638b11470a092b8326c6.zip
Enhance the mirror details page
Get the URLs with their performance data showing up, and simplify the top part for non-authenticated users while adding more detail for logged-in users. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'mirrors')
-rw-r--r--mirrors/views.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/mirrors/views.py b/mirrors/views.py
index a2b94de8..032a4700 100644
--- a/mirrors/views.py
+++ b/mirrors/views.py
@@ -104,10 +104,19 @@ def mirror_details(request, name):
mirror = get_object_or_404(Mirror, name=name)
if not request.user.is_authenticated() and \
(not mirror.public or not mirror.active):
- # TODO: maybe this should be 403? but that would leak existence
raise Http404
+
+ status_info = get_mirror_statuses()
+ checked_urls = [url for url in status_info['urls'] \
+ if url.mirror_id == mirror.id]
+ all_urls = mirror.urls.select_related('protocol')
+ # get each item from checked_urls and supplement with anything in all_urls
+ # if it wasn't there
+ all_urls = set(checked_urls).union(all_urls)
+ all_urls = sorted(all_urls, key=lambda x: x.url)
+
return direct_to_template(request, 'mirrors/mirror_details.html',
- {'mirror': mirror})
+ {'mirror': mirror, 'urls': all_urls})
def status(request):
bad_timedelta = datetime.timedelta(days=3)