Use more modern verison of string template formatting
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
a10798b756
commit
dc6cc49f6f
@ -1,6 +1,5 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
from string import Template
|
|
||||||
from urllib import urlencode
|
from urllib import urlencode
|
||||||
|
|
||||||
from django.http import HttpResponse, Http404
|
from django.http import HttpResponse, Http404
|
||||||
@ -223,12 +222,9 @@ def download(request, name, repo, arch):
|
|||||||
# grab the first non-any arch to fake the download path
|
# grab the first non-any arch to fake the download path
|
||||||
arch = Arch.objects.exclude(agnostic=True)[0].name
|
arch = Arch.objects.exclude(agnostic=True)[0].name
|
||||||
values = {
|
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)
|
return redirect(url)
|
||||||
|
|
||||||
# vim: set ts=4 sw=4 et:
|
# vim: set ts=4 sw=4 et:
|
||||||
|
Loading…
Reference in New Issue
Block a user