diff options
author | Dan McGee <dan@archlinux.org> | 2010-08-28 17:38:12 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-08-28 17:43:39 +0200 |
commit | 4c3100ab907b9edafad7913c03278caaa22ed4d1 (patch) | |
tree | 264cb8045b0569ac369075ba3dbd1059a924b356 /packages | |
parent | 971e9faf906d686e05b641f497ba37ee605d4a47 (diff) | |
download | archweb-4c3100ab907b9edafad7913c03278caaa22ed4d1.tar.gz archweb-4c3100ab907b9edafad7913c03278caaa22ed4d1.tar.xz |
Move differences into it's own function
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages')
-rw-r--r-- | packages/views.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/packages/views.py b/packages/views.py index 20fdb39..cef7828 100644 --- a/packages/views.py +++ b/packages/views.py @@ -400,17 +400,14 @@ def download(request, name='', repo='', arch=''): url = string.Template('${host}${repo}/os/${arch}/${file}').substitute(details) return HttpResponseRedirect(url) -def arch_differences(request): +@cache_function(300) +def get_differences_information(arch_a, arch_b): from django.db import connection - from operator import itemgetter # This is a monster. Join packages against itself, looking for packages in # our non-'any' architectures only, and not having a corresponding package # entry in the other table (or having one with a different pkgver). We will # then go and fetch all of these packages from the database and display # them later using normal ORM models. - # TODO: we have some hardcoded magic here with respect to the arches. - arch_a = Arch.objects.get(name='i686') - arch_b = Arch.objects.get(name='x86_64') sql = """ SELECT p.id, q.id FROM packages p @@ -458,7 +455,13 @@ SELECT p.id, q.id # now sort our list by repository, package name differences.sort(key=lambda a: (a[1].name, a[0])) + return differences +def arch_differences(request): + # TODO: we have some hardcoded magic here with respect to the arches. + arch_a = Arch.objects.get(name='i686') + arch_b = Arch.objects.get(name='x86_64') + differences = get_differences_information(arch_a, arch_b) context = { 'arch_a': arch_a, 'arch_b': arch_b, |