From ba678e4b290e5fec5d1ce4e2267881a2c07f3635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Thu, 4 May 2017 00:23:43 +0300 Subject: [PATCH] api: Remove unused event_source decorator --- certidude/api/__init__.py | 3 +-- certidude/decorators.py | 10 ---------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/certidude/api/__init__.py b/certidude/api/__init__.py index fc21c25..fb905a9 100644 --- a/certidude/api/__init__.py +++ b/certidude/api/__init__.py @@ -11,7 +11,7 @@ from time import sleep from certidude import authority, mailer from certidude.auth import login_required, authorize_admin from certidude.user import User -from certidude.decorators import serialize, event_source, csrf_protection +from certidude.decorators import serialize, csrf_protection from cryptography.x509.oid import NameOID from certidude import const, config @@ -31,7 +31,6 @@ class SessionResource(object): @csrf_protection @serialize @login_required - @event_source def on_get(self, req, resp): import xattr diff --git a/certidude/decorators.py b/certidude/decorators.py index 8cb1169..7a7327d 100644 --- a/certidude/decorators.py +++ b/certidude/decorators.py @@ -40,16 +40,6 @@ def csrf_protection(func): return wrapped -def event_source(func): - import falcon - def wrapped(self, req, resp, *args, **kwargs): - if req.get_header("Accept") == "text/event-stream": - resp.status = falcon.HTTP_SEE_OTHER - resp.location = req.context.get("ca").push_server + "/ev/" + req.context.get("ca").uuid - resp.body = "Redirecting to:" + resp.location - return func(self, req, resp, *args, **kwargs) - return wrapped - class MyEncoder(json.JSONEncoder): def default(self, obj): from certidude.auth import User