Handle user events Redis not working in tutorial

Also does some basic restyling

Fixes #1586
This commit is contained in:
Joseph Schorr 2016-06-28 15:35:21 -04:00
parent 073b643aab
commit 310ecd11cc
6 changed files with 169 additions and 162 deletions

View file

@ -7,6 +7,7 @@ from auth.auth import require_session_login
from endpoints.common import route_show_if
from app import app, userevents
from auth.permissions import SuperUserPermission
from data.userevent import CannotReadUserEventsException
import features
import psutil
@ -107,5 +108,9 @@ def user_subscribe():
if not events:
abort(404)
listener = userevents.get_listener(current_user.db_user().username, events)
try:
listener = userevents.get_listener(current_user.db_user().username, events)
except CannotReadUserEventsException:
abort(504)
return Response(wrapper(listener), mimetype="text/event-stream")