From 0fcf1db00a224d055d208601af36406019ad1706 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Mon, 29 Oct 2012 19:17:26 -0400 Subject: [PATCH] Fix tracebacks sending messages nobody will receive. (imported from commit afe3d7465f105015f7fa8247ab3cba7476b89fc2) --- zephyr/views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zephyr/views.py b/zephyr/views.py index 3c8f3563b6..b4eeb29c5b 100644 --- a/zephyr/views.py +++ b/zephyr/views.py @@ -699,6 +699,12 @@ def notify_new_message(request, handler): if not validate_notify(request, handler): return + # If a message for some reason has no recipients (e.g. it is sent + # by a bot to a stream that nobody is subscribed to), just skip + # the message gracefully + if request.POST["users"] == "": + return + # FIXME: better query users = [UserProfile.objects.get(id=user) for user in request.POST['users'].split(',')]