summaryrefslogtreecommitdiff
path: root/pgcommitfest/commitfest/models.py
diff options
context:
space:
mode:
authorMagnus Hagander2016-02-15 09:38:31 +0000
committerMagnus Hagander2016-02-15 09:38:31 +0000
commit4988c42bcc50c93730f4693a85cbce41ebf77a58 (patch)
treec7596ae1fe001fcffda109edb663afa2013f0cbf /pgcommitfest/commitfest/models.py
parentec1d9deaa33196b94366ade3fdc746a705996bc2 (diff)
Don't crash with committers without user profiles
Userprofiles aren't set for everbody, so catch a missing exception and just ignore it since we know a user without a profile didn't specifically ask to get notified (as that's stored in the profile).
Diffstat (limited to 'pgcommitfest/commitfest/models.py')
-rw-r--r--pgcommitfest/commitfest/models.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/pgcommitfest/commitfest/models.py b/pgcommitfest/commitfest/models.py
index 04d2fb4..5ee0a5b 100644
--- a/pgcommitfest/commitfest/models.py
+++ b/pgcommitfest/commitfest/models.py
@@ -5,6 +5,8 @@ from datetime import datetime
from util import DiffableModel
+from pgcommitfest.userprofile.models import UserProfile
+
# We have few enough of these, and it's really the only thing we
# need to extend from the user model, so just create a separate
# class.
@@ -223,10 +225,17 @@ class PatchHistory(models.Model):
recipients.extend(self.patch.subscribers.all())
# Current or previous committer wants all notifications
- if self.patch.committer and self.patch.committer.user.userprofile.notify_all_committer:
- recipients.append(self.patch.committer.user)
- if prevcommitter and prevcommitter.user.userprofile.notify_all_committer:
- recipients.append(prevcommitter.user)
+ try:
+ if self.patch.committer and self.patch.committer.user.userprofile.notify_all_committer:
+ recipients.append(self.patch.committer.user)
+ except UserProfile.DoesNotExist:
+ pass
+
+ try:
+ if prevcommitter and prevcommitter.user.userprofile.notify_all_committer:
+ recipients.append(prevcommitter.user)
+ except UserProfile.DoesNotExist:
+ pass
# Current or previous reviewers wants all notifications
recipients.extend(self.patch.reviewers.filter(userprofile__notify_all_reviewer=True))