summaryrefslogtreecommitdiff
path: root/releng/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'releng/views.py')
-rw-r--r--releng/views.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/releng/views.py b/releng/views.py
index 6c49275f..ad4b07d1 100644
--- a/releng/views.py
+++ b/releng/views.py
@@ -1,7 +1,9 @@
+from base64 import b64decode
+
from django import forms
from django.conf import settings
from django.db.models import Count, Max
-from django.http import Http404
+from django.http import Http404, HttpResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.views.generic import DetailView, ListView
@@ -224,4 +226,16 @@ class ReleaseDetailView(DetailView):
slug_field = 'version'
slug_url_kwarg = 'version'
+
+def release_torrent(request, version):
+ release = get_object_or_404(Release, version=version)
+ if not release.torrent_data:
+ raise Http404
+ data = b64decode(release.torrent_data)
+ response = HttpResponse(data, content_type='application/x-bittorrent')
+ # TODO: this is duplicated from Release.iso_url()
+ filename = 'archlinux-%s-dual.iso.torrent' % release.version
+ response['Content-Disposition'] = 'attachment; filename=%s' % filename
+ return response
+
# vim: set ts=4 sw=4 et: