summaryrefslogtreecommitdiffstats
path: root/main/models.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-02-27 01:45:14 +0100
committerDan McGee <dan@archlinux.org>2013-02-27 01:45:14 +0100
commitf85cc0482a44ced9aed372b8972d31040ed4043b (patch)
treef0790247018bfa5c243fff623f917d7a7a8bf0cf /main/models.py
parent1457f78594a25f8cfb8ad1f9b3cd6d071a3d6a93 (diff)
parenta25cc4ff459ab0070ce48730f6c6fdc227860f08 (diff)
downloadarchweb-f85cc0482a44ced9aed372b8972d31040ed4043b.tar.gz
archweb-f85cc0482a44ced9aed372b8972d31040ed4043b.tar.xz
Merge branch 'django-1.5'
Conflicts: requirements.txt requirements_prod.txt
Diffstat (limited to 'main/models.py')
-rw-r--r--main/models.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/main/models.py b/main/models.py
index 46fd3a6..ec5c2bd 100644
--- a/main/models.py
+++ b/main/models.py
@@ -177,12 +177,15 @@ class Package(models.Model):
def maintainers(self, maintainers):
self._maintainers = maintainers
- @cache_function(1800)
+ _applicable_arches = None
+
def applicable_arches(self):
'''The list of (this arch) + (available agnostic arches).'''
- arches = set(Arch.objects.filter(agnostic=True))
- arches.add(self.arch)
- return list(arches)
+ if self._applicable_arches is None:
+ arches = set(Arch.objects.filter(agnostic=True))
+ arches.add(self.arch)
+ self._applicable_arches = list(arches)
+ return self._applicable_arches
@cache_function(119)
def get_requiredby(self):
@@ -277,10 +280,10 @@ class Package(models.Model):
# TODO: we can use list comprehension and an 'in' query to make this
# more effective
for dep in self.depends.all():
- pkg = dep.get_best_satisfier(self)
+ pkg = dep.get_best_satisfier()
providers = None
if not pkg:
- providers = dep.get_providers(self)
+ providers = dep.get_providers()
deps.append({'dep': dep, 'pkg': pkg, 'providers': providers})
# sort the list; deptype sorting makes this tricker than expected
sort_order = {'D': 0, 'O': 1, 'M': 2, 'C': 3}