diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-12-22 21:50:58 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-12-22 21:50:58 -0500 |
commit | 2bfec5b17ca3ee3ea3b347c029b9d8dad3c5b4d0 (patch) | |
tree | 6bda86f6489fbdfdce67d282b20586fc6032735b /mirrors/views.py | |
parent | 3579e3cb34a53abd16da3af78be738c2a4dd0d5c (diff) | |
parent | 36f5e1df9afbeac1d04fee38dde4c28f81144a20 (diff) |
Merge tag 'release_2013-12-19' into archweb-generic
Mirror URL page, other random stuff
Diffstat (limited to 'mirrors/views.py')
-rw-r--r-- | mirrors/views.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/mirrors/views.py b/mirrors/views.py index 9e05e5fc..34336165 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,26 @@ def mirror_details_json(request, name): return response +def url_details(request, name, url_id): + url = get_object_or_404(MirrorUrl.objects.select_related(), + 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.select_related('location').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) |