diff options
author | Magnus Hagander | 2016-02-27 14:21:02 +0000 |
---|---|---|
committer | Magnus Hagander | 2016-02-27 14:21:02 +0000 |
commit | 61219385bccc67a059437818a9f9e53a6beee048 (patch) | |
tree | a49b9169c8ac57fade4f3cc8cf44e0e06498a4d3 | |
parent | 4988c42bcc50c93730f4693a85cbce41ebf77a58 (diff) |
Don't crash on subscribers without a profile
-rw-r--r-- | pgcommitfest/commitfest/management/commands/send_notifications.py | 8 |
1 files 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, |