summaryrefslogtreecommitdiff
path: root/packages/utils.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-12-27 23:25:51 -0600
committerDan McGee <dan@archlinux.org>2012-12-28 00:33:03 -0600
commitb801818eeed1068595cea863e9ae427f3931f925 (patch)
tree39d94038185b1c78485823be87e6ef96d667a80e /packages/utils.py
parent3227db7b47c8eae59a5139fc7f3486365469045b (diff)
Make attach_maintainers null-safe
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages/utils.py')
-rw-r--r--packages/utils.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/utils.py b/packages/utils.py
index 5adc8637..5f0c111e 100644
--- a/packages/utils.py
+++ b/packages/utils.py
@@ -249,7 +249,7 @@ def attach_maintainers(packages):
the maintainers and attach them to the packages to prevent N+1 query
cascading.'''
packages = list(packages)
- pkgbases = {p.pkgbase for p in packages}
+ pkgbases = {p.pkgbase for p in packages if p is not None}
rels = PackageRelation.objects.filter(type=PackageRelation.MAINTAINER,
pkgbase__in=pkgbases).values_list(
'pkgbase', 'user_id').order_by().distinct()
@@ -266,6 +266,8 @@ def attach_maintainers(packages):
annotated = []
# and finally, attach the maintainer lists on the original packages
for package in packages:
+ if package is None:
+ continue
package.maintainers = maintainers[package.pkgbase]
annotated.append(package)