diff options
author | Dan McGee <dan@archlinux.org> | 2013-12-15 13:22:41 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2013-12-15 13:28:13 -0600 |
commit | 79aef280ddf0c704fd40d0077822a8ff7548437e (patch) | |
tree | 706e88b3e072402feeb1baee7e6cbaa658226aeb /mirrors/views.py | |
parent | 3c7b02753a4f742eeb66b8deea2fc3f179b87b8e (diff) |
Add mirror URL details page
This will allow those that care about mirrors to zoom into URL-level
details for each mirror and examine the individual check results.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'mirrors/views.py')
-rw-r--r-- | mirrors/views.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/mirrors/views.py b/mirrors/views.py index 9e05e5fc..b2e75b25 100644 --- a/mirrors/views.py +++ b/mirrors/views.py @@ -186,6 +186,7 @@ def mirror_details(request, name): } return render(request, 'mirrors/mirror_details.html', context) + def mirror_details_json(request, name): authorized = request.user.is_authenticated() mirror = get_object_or_404(Mirror, name=name) @@ -199,6 +200,24 @@ def mirror_details_json(request, name): return response +def url_details(request, name, url_id): + url = get_object_or_404(MirrorUrl, id=url_id, mirror__name=name) + mirror = url.mirror + authorized = request.user.is_authenticated() + if not authorized and \ + (not mirror.public or not mirror.active or not url.active): + raise Http404 + error_cutoff = timedelta(days=7) + cutoff_time = now() - error_cutoff + logs = MirrorLog.objects.filter(url=url, check_time__gte=cutoff_time).order_by('-check_time') + + context = { + 'url': url, + 'logs': logs, + } + return render(request, 'mirrors/url_details.html', context) + + def status(request, tier=None): if tier is not None: tier = int(tier) |