summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreliott <eliott@cactuswax.net>2008-04-17 23:56:18 -0700
committereliott <eliott@cactuswax.net>2008-04-17 23:56:18 -0700
commit532edf85eb036631d7d007a4a2db7728edf12bb7 (patch)
tree70b5a4864f30f68e6f4979b66ffa6a716598874c
parent42c88bd1b945e9eae6ec584d9f17b92dbde2eb8f (diff)
Modified get_depends handling slightly
-rw-r--r--main/models.py6
-rw-r--r--main/tests.py5
-rw-r--r--templates/packages/details.html8
3 files changed, 11 insertions, 8 deletions
diff --git a/main/models.py b/main/models.py
index ef8f6cd1..333becca 100644
--- a/main/models.py
+++ b/main/models.py
@@ -235,11 +235,11 @@ class Package(models.Model):
if len(pkgs) == 0:
# couldn't find a package in the DB
# it should be a virtual depend (or a removed package)
- deps.append((None, dep.depname, None))
+ deps.append({'dep': dep, 'pkg': None})
continue
else:
- for p in pkgs:
- deps.append((p.id,dep.depname,dep.depvcmp))
+ for pkg in pkgs:
+ deps.append({'dep': dep, 'pkg': pkg})
return deps
class PackageFile(models.Model):
diff --git a/main/tests.py b/main/tests.py
index 7b870c92..d0e87729 100644
--- a/main/tests.py
+++ b/main/tests.py
@@ -21,7 +21,10 @@ class ModelTest(TestCase):
Test the Package object's get_depends() method
"""
p = Package.objects.get(pkgname='abs',arch__name__iexact='i686')
- expected = [(7L, 'bash', ''), (None, 'rsync', None)]
+ dep1 = {'dep': PackageDepend.objects.get(id=1),
+ 'pkg': Package.objects.get(id=7)}
+ dep2 = {'dep': PackageDepend.objects.get(id=2), 'pkg': None}
+ expected = [dep1, dep2]
results = p.get_depends()
self.failUnlessEqual(results, expected)
del p
diff --git a/templates/packages/details.html b/templates/packages/details.html
index 2b638852..4a1f1e4a 100644
--- a/templates/packages/details.html
+++ b/templates/packages/details.html
@@ -55,11 +55,11 @@
<div class="listing">
<h4>Dependencies:</h4>
<ul style="font-size:small;list-style:none">
- {% for dep in pkg.get_depends %}
- {% ifequal dep.0 None %}
- <li>{{ dep.1 }}</li>
+ {% for depend in pkg.get_depends %}
+ {% ifequal depend.pkg None %}
+ <li>{{ depend.dep.depname }} (virtual)</li>
{% else %}
- <li><a href="/packages/{{ dep.0 }}/">{{ dep.1 }}</a>{{ dep.2 }}</li>
+ <li><a href="/packages/{{ depend.pkg.id }}/">{{ depend.dep.depname }}</a>{{ depend.dep.depvcmp }}</li>
{% endifequal %}
{% endfor %}
</ul>