summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-12-28 06:25:51 +0100
committerDan McGee <dan@archlinux.org>2012-12-28 07:33:03 +0100
commitb801818eeed1068595cea863e9ae427f3931f925 (patch)
tree39d94038185b1c78485823be87e6ef96d667a80e
parent3227db7b47c8eae59a5139fc7f3486365469045b (diff)
downloadarchweb-b801818eeed1068595cea863e9ae427f3931f925.tar.gz
archweb-b801818eeed1068595cea863e9ae427f3931f925.tar.xz
Make attach_maintainers null-safe
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--packages/utils.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/utils.py b/packages/utils.py
index 5adc863..5f0c111 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)