1
0
mirror of https://github.com/laurivosandi/certidude synced 2024-12-23 00:25:18 +00:00

api: Remove unused event_source decorator

This commit is contained in:
Lauri Võsandi 2017-05-04 00:23:43 +03:00
parent aeb5d81aa6
commit ba678e4b29
2 changed files with 1 additions and 12 deletions

View File

@ -11,7 +11,7 @@ from time import sleep
from certidude import authority, mailer from certidude import authority, mailer
from certidude.auth import login_required, authorize_admin from certidude.auth import login_required, authorize_admin
from certidude.user import User 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 cryptography.x509.oid import NameOID
from certidude import const, config from certidude import const, config
@ -31,7 +31,6 @@ class SessionResource(object):
@csrf_protection @csrf_protection
@serialize @serialize
@login_required @login_required
@event_source
def on_get(self, req, resp): def on_get(self, req, resp):
import xattr import xattr

View File

@ -40,16 +40,6 @@ def csrf_protection(func):
return wrapped 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): class MyEncoder(json.JSONEncoder):
def default(self, obj): def default(self, obj):
from certidude.auth import User from certidude.auth import User