Make sure new_notification is actually in POST before we try to use it
authorMagnus Hagander <magnus@hagander.net>
Fri, 6 Jul 2012 08:06:30 +0000 (10:06 +0200)
committerMagnus Hagander <magnus@hagander.net>
Fri, 6 Jul 2012 08:06:30 +0000 (10:06 +0200)
pgweb/util/admin.py

index bb84a9872f8e28ed84d086c2fc8cc4f38ec6a6b9..371de9e764dcf34c229da6b17e66e2799e7a14c4 100644 (file)
@@ -59,7 +59,7 @@ class PgwebAdmin(admin.ModelAdmin):
                if change and self.model.send_notification:
                        # We only do processing if something changed, not when adding
                        # a new object.
-                       if request.POST['new_notification']:
+                       if request.POST.has_key('new_notification') and request.POST['new_notification']:
                                # Need to send off a new notification. We'll also store
                                # it in the database for future reference, of course.
                                if not obj.org.email: