From f8b134f0a99d1bc0d45c4324f44a950f3ea46368 Mon Sep 17 00:00:00 2001 From: Rohan Rangray Date: Wed, 3 Jun 2015 17:14:51 -0700 Subject: [PATCH] Noisly fail notify() if the user's registration_id is null --- flashcards/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flashcards/models.py b/flashcards/models.py index f5ecaa4..b5cd1a7 100644 --- a/flashcards/models.py +++ b/flashcards/models.py @@ -99,6 +99,8 @@ class User(AbstractUser, SimpleEmailConfirmationUserMixin): "noreply@flashy.cards", [self.email]) def notify(self): + if self.registration_id is None: + raise ValueError("user's registration_id is null") gcm_ctx = gcm.GCM(GCM_API_KEY) try: gcm_ctx.plaintext_request( -- 1.9.1