From 61219385bccc67a059437818a9f9e53a6beee048 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Sat, 27 Feb 2016 09:21:02 -0500 Subject: [PATCH] Don't crash on subscribers without a profile --- .../commitfest/management/commands/send_notifications.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pgcommitfest/commitfest/management/commands/send_notifications.py b/pgcommitfest/commitfest/management/commands/send_notifications.py index 634af58..6a8fe42 100644 --- a/pgcommitfest/commitfest/management/commands/send_notifications.py +++ b/pgcommitfest/commitfest/management/commands/send_notifications.py @@ -5,6 +5,7 @@ from django.conf import settings from StringIO import StringIO from pgcommitfest.commitfest.models import PendingNotification +from pgcommitfest.userprofile.models import UserProfile from pgcommitfest.mailqueue.util import send_template_mail class Command(BaseCommand): @@ -27,8 +28,11 @@ class Command(BaseCommand): for v in matches.values(): user = v['user'] email = user.email - if user.userprofile and user.userprofile.notifyemail: - email = user.userprofile.notifyemail.email + try: + if user.userprofile and user.userprofile.notifyemail: + email = user.userprofile.notifyemail.email + except UserProfile.DoesNotExist: + pass send_template_mail(settings.NOTIFICATION_FROM, None, -- 2.39.5