summaryrefslogtreecommitdiff
path: root/visualize/views.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-10-11 19:29:15 -0500
committerDan McGee <dan@archlinux.org>2011-10-11 19:29:15 -0500
commit71e57570c262fffb11ca6e0dc97342119198f740 (patch)
tree3736af12cda316baffbcc4e5ba2a43f41901b847 /visualize/views.py
parenta01a11cfad84bd44c1f5aeffcc0665bd93889e1d (diff)
Pylint suggested and other cleanups
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'visualize/views.py')
-rw-r--r--visualize/views.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/visualize/views.py b/visualize/views.py
index 68f5d4a5..f2b1d63b 100644
--- a/visualize/views.py
+++ b/visualize/views.py
@@ -18,10 +18,20 @@ def arch_repo_data():
arches = Arch.objects.values_list('name', flat=True)
repos = Repo.objects.values_list('name', flat=True)
+ def build_map(name, arch, repo):
+ key = '%s:%s' % (repo or '', arch or '')
+ return {
+ 'key': key,
+ 'name': name,
+ 'arch': arch,
+ 'repo': repo,
+ 'data': [],
+ }
+
# now transform these results into two mappings: one ordered (repo, arch),
# and one ordered (arch, repo).
- arch_groups = dict((a, { 'name': a, 'key': ':%s' % a, 'arch': a, 'repo': None, 'data': [] }) for a in arches)
- repo_groups = dict((r, { 'name': r, 'key': '%s:' % r, 'arch': None, 'repo': r, 'data': [] }) for r in repos)
+ arch_groups = dict((a, build_map(a, a, None)) for a in arches)
+ repo_groups = dict((r, build_map(r, None, r)) for r in repos)
for row in qs:
arch = row['arch__name']
repo = row['repo__name']