summaryrefslogtreecommitdiff
path: root/packages/views/display.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-01-25 09:54:24 -0700
committerDan McGee <dan@archlinux.org>2013-01-25 09:54:24 -0700
commit4244ff7a42566949f8ee85e922ed48f4a80407f7 (patch)
tree21caf4d67aa36d06c6a921608901ad059752e744 /packages/views/display.py
parentf9252df1138ae388168cf76cb3d654a2abbce4ec (diff)
parentdc6cc49f6f876983f76f5f8c05a2285801f27ea0 (diff)
Merge branch 'on-the-plane'release_2013-01-25
Diffstat (limited to 'packages/views/display.py')
-rw-r--r--packages/views/display.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/packages/views/display.py b/packages/views/display.py
index 445c1abe..497c8d48 100644
--- a/packages/views/display.py
+++ b/packages/views/display.py
@@ -1,6 +1,5 @@
import datetime
import json
-from string import Template
from urllib import urlencode
from django.http import HttpResponse, Http404
@@ -168,7 +167,7 @@ def group_details(request, arch, name):
def files(request, name, repo, arch):
- pkg = get_object_or_404(Package,
+ pkg = get_object_or_404(Package.objects.normal(),
pkgname=name, repo__name__iexact=repo, arch__name=arch)
# files are inserted in sorted order, so preserve that
fileslist = PackageFile.objects.filter(pkg=pkg).order_by('id')
@@ -185,14 +184,14 @@ def files(request, name, repo, arch):
def details_json(request, name, repo, arch):
- pkg = get_object_or_404(Package,
+ pkg = get_object_or_404(Package.objects.normal(),
pkgname=name, repo__name__iexact=repo, arch__name=arch)
to_json = json.dumps(pkg, ensure_ascii=False, cls=PackageJSONEncoder)
return HttpResponse(to_json, content_type='application/json')
def files_json(request, name, repo, arch):
- pkg = get_object_or_404(Package,
+ pkg = get_object_or_404(Package.objects.normal(),
pkgname=name, repo__name__iexact=repo, arch__name=arch)
# files are inserted in sorted order, so preserve that
fileslist = PackageFile.objects.filter(pkg=pkg).order_by('id')
@@ -213,7 +212,7 @@ def files_json(request, name, repo, arch):
def download(request, name, repo, arch):
- pkg = get_object_or_404(Package,
+ pkg = get_object_or_404(Package.objects.normal(),
pkgname=name, repo__name__iexact=repo, arch__name=arch)
url = get_mirror_url_for_download()
if not url:
@@ -223,12 +222,9 @@ def download(request, name, repo, arch):
# grab the first non-any arch to fake the download path
arch = Arch.objects.exclude(agnostic=True)[0].name
values = {
- 'host': url.url,
- 'arch': arch,
- 'repo': pkg.repo.name.lower(),
- 'file': pkg.filename,
}
- url = Template('${host}${repo}/os/${arch}/${file}').substitute(values)
+ url = '{host}{repo}/os/{arch}/{filename}'.format(host=url.url,
+ repo=pkg.repo.name.lower(), arch=arch, filename=pkg.filename)
return redirect(url)
# vim: set ts=4 sw=4 et: