mirror of
https://github.com/laurivosandi/certidude
synced 2024-12-22 16:25:17 +00:00
api: Remove unused event_source decorator
This commit is contained in:
parent
aeb5d81aa6
commit
ba678e4b29
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user