diff options
author | Dan McGee <dan@archlinux.org> | 2012-12-28 06:25:51 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-12-28 07:33:03 +0100 |
commit | b801818eeed1068595cea863e9ae427f3931f925 (patch) | |
tree | 39d94038185b1c78485823be87e6ef96d667a80e /packages | |
parent | 3227db7b47c8eae59a5139fc7f3486365469045b (diff) | |
download | archweb-b801818eeed1068595cea863e9ae427f3931f925.tar.gz archweb-b801818eeed1068595cea863e9ae427f3931f925.tar.xz |
Make attach_maintainers null-safe
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages')
-rw-r--r-- | packages/utils.py | 4 |
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) |