summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-12-07 13:52:40 -0600
committerDan McGee <dan@archlinux.org>2010-12-07 13:52:40 -0600
commite8feaa3e01fdb326e82139ff80fce34f7e088438 (patch)
tree328f8af9a61e791ac798108336446f5cb650ea31
parent681dba9eef7991c5113d35562b3ace55bb782ad4 (diff)
Save DB query when filtering dependencies for testing
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--main/models.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/main/models.py b/main/models.py
index af4466ff..ec2416f7 100644
--- a/main/models.py
+++ b/main/models.py
@@ -198,10 +198,8 @@ class Package(models.Model):
# more than one package, see if we can't shrink it down
# grab the first though in case we fail
pkg = pkgs[0]
- if self.repo.testing:
- pkgs = pkgs.filter(repo__testing=True)
- else:
- pkgs = pkgs.filter(repo__testing=False)
+ # prevents yet more DB queries, these lists should be short
+ pkgs = [p for p in pkgs if p.repo.testing == self.repo.testing]
if len(pkgs) > 0:
pkg = pkgs[0]
deps.append({'dep': dep, 'pkg': pkg})