mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
Codestyle++
This commit is contained in:
parent
ca8d438e79
commit
b0c2415f55
@ -59,13 +59,12 @@ def user_ressource_session_handler(app, user_id, session_id, foreign=False):
|
||||
' NOTE: The initial values are send as a init events.
|
||||
' The JSON patches are send as update events.
|
||||
'''
|
||||
init_events = {'corpora': 'foreign_corpora_init' if foreign
|
||||
else 'corpora_init',
|
||||
'jobs': 'foreign_jobs_init' if foreign else 'jobs_init'}
|
||||
update_events = {'corpora': 'foreign_corpora_update' if foreign
|
||||
else 'corpora_update',
|
||||
'jobs': 'foreign_jobs_update' if foreign
|
||||
else 'jobs_update'}
|
||||
init_events = \
|
||||
{'corpora': 'foreign_corpora_init' if foreign else 'corpora_init',
|
||||
'jobs': 'foreign_jobs_init' if foreign else 'jobs_init'}
|
||||
update_events = \
|
||||
{'corpora': 'foreign_corpora_update' if foreign else 'corpora_update',
|
||||
'jobs': 'foreign_jobs_update' if foreign else 'jobs_update'}
|
||||
with app.app_context():
|
||||
# Gather current values from database.
|
||||
user = User.query.get(user_id)
|
||||
@ -77,7 +76,8 @@ def user_ressource_session_handler(app, user_id, session_id, foreign=False):
|
||||
socketio.emit(init_events['jobs'], json.dumps(jobs), room=session_id)
|
||||
while session_id in connected_sessions:
|
||||
# Get new values from the database
|
||||
new_corpora = {corpus.id: corpus.to_dict() for corpus in user.corpora}
|
||||
new_corpora = {corpus.id: corpus.to_dict()
|
||||
for corpus in user.corpora}
|
||||
new_jobs = {job.id: job.to_dict() for job in user.jobs}
|
||||
# Compute JSON patches.
|
||||
corpora_patch = jsonpatch.JsonPatch.from_diff(corpora, new_corpora)
|
||||
|
Loading…
Reference in New Issue
Block a user