mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-26 03:14:19 +00:00
20 lines
457 B
Python
20 lines
457 B
Python
|
from flask_login import current_user, login_required
|
||
|
from flask_socketio import emit
|
||
|
from .. import socketio
|
||
|
import json
|
||
|
|
||
|
|
||
|
@socketio.on('connect')
|
||
|
@login_required
|
||
|
def connect():
|
||
|
corpora = []
|
||
|
jobs = []
|
||
|
|
||
|
for corpus in current_user.corpora:
|
||
|
corpora.append(corpus.to_dict())
|
||
|
for job in current_user.jobs:
|
||
|
jobs.append(job.to_dict())
|
||
|
|
||
|
emit('corpora', {'data': json.dumps(corpora)})
|
||
|
emit('jobs', {'data': json.dumps(jobs)})
|