mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-27 03:44:19 +00:00
38 lines
975 B
Python
38 lines
975 B
Python
|
from cqi import CQiClient
|
||
|
from threading import Lock
|
||
|
from flask import session
|
||
|
|
||
|
|
||
|
class CQiOverSocketIOSessionManager:
|
||
|
@staticmethod
|
||
|
def setup():
|
||
|
session['cqi_over_sio'] = {}
|
||
|
|
||
|
@staticmethod
|
||
|
def teardown():
|
||
|
session.pop('cqi_over_sio')
|
||
|
|
||
|
@staticmethod
|
||
|
def set_corpus_id(corpus_id: int):
|
||
|
session['cqi_over_sio']['corpus_id'] = corpus_id
|
||
|
|
||
|
@staticmethod
|
||
|
def get_corpus_id() -> int:
|
||
|
return session['cqi_over_sio']['corpus_id']
|
||
|
|
||
|
@staticmethod
|
||
|
def set_cqi_client(cqi_client: CQiClient):
|
||
|
session['cqi_over_sio']['cqi_client'] = cqi_client
|
||
|
|
||
|
@staticmethod
|
||
|
def get_cqi_client() -> CQiClient:
|
||
|
return session['cqi_over_sio']['cqi_client']
|
||
|
|
||
|
@staticmethod
|
||
|
def set_cqi_client_lock(cqi_client_lock: Lock):
|
||
|
session['cqi_over_sio']['cqi_client_lock'] = cqi_client_lock
|
||
|
|
||
|
@staticmethod
|
||
|
def get_cqi_client_lock() -> Lock:
|
||
|
return session['cqi_over_sio']['cqi_client_lock']
|