mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-04 04:12:45 +00:00 
			
		
		
		
	Move event handlers to a dedicated event directory
This commit is contained in:
		@@ -32,8 +32,8 @@ def create_app(config_name):
 | 
				
			|||||||
        app, message_queue=app.config['NOPAQUE_SOCKETIO_MESSAGE_QUEUE_URI'])
 | 
					        app, message_queue=app.config['NOPAQUE_SOCKETIO_MESSAGE_QUEUE_URI'])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    with app.app_context():
 | 
					    with app.app_context():
 | 
				
			||||||
        from . import socketio_events
 | 
					        from .events import socketio as socketio_events
 | 
				
			||||||
        from . import sqlalchemy_events
 | 
					        from .events import sqlalchemy as sqlalchemy_events
 | 
				
			||||||
        from .admin import admin as admin_blueprint
 | 
					        from .admin import admin as admin_blueprint
 | 
				
			||||||
        from .auth import auth as auth_blueprint
 | 
					        from .auth import auth as auth_blueprint
 | 
				
			||||||
        from .corpora import corpora as corpora_blueprint
 | 
					        from .corpora import corpora as corpora_blueprint
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,7 @@ from socket import gaierror
 | 
				
			|||||||
from werkzeug.utils import secure_filename
 | 
					from werkzeug.utils import secure_filename
 | 
				
			||||||
from .. import db, socketio
 | 
					from .. import db, socketio
 | 
				
			||||||
from ..decorators import socketio_login_required
 | 
					from ..decorators import socketio_login_required
 | 
				
			||||||
from ..socketio_events import socketio_sessions
 | 
					from ..events.socketio import sessions as socketio_sessions
 | 
				
			||||||
from ..models import Corpus
 | 
					from ..models import Corpus
 | 
				
			||||||
import cqi
 | 
					import cqi
 | 
				
			||||||
import math
 | 
					import math
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,9 +1,9 @@
 | 
				
			|||||||
from flask import request
 | 
					from flask import request
 | 
				
			||||||
from flask_login import current_user
 | 
					from flask_login import current_user
 | 
				
			||||||
from flask_socketio import join_room, leave_room
 | 
					from flask_socketio import join_room, leave_room
 | 
				
			||||||
from . import socketio
 | 
					from .. import socketio
 | 
				
			||||||
from .decorators import socketio_login_required
 | 
					from ..decorators import socketio_login_required
 | 
				
			||||||
from .models import User
 | 
					from ..models import User
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
'''
 | 
					'''
 | 
				
			||||||
@@ -11,7 +11,7 @@ from .models import User
 | 
				
			|||||||
' of all connected sessions, which can be used to determine the runtimes of
 | 
					' of all connected sessions, which can be used to determine the runtimes of
 | 
				
			||||||
' associated background tasks.
 | 
					' associated background tasks.
 | 
				
			||||||
'''
 | 
					'''
 | 
				
			||||||
socketio_sessions = []
 | 
					sessions = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
###############################################################################
 | 
					###############################################################################
 | 
				
			||||||
@@ -24,7 +24,7 @@ def socketio_connect():
 | 
				
			|||||||
    ' The Socket.IO module creates a session id (sid) for each request.
 | 
					    ' The Socket.IO module creates a session id (sid) for each request.
 | 
				
			||||||
    ' On connect the sid is saved in the connected sessions list.
 | 
					    ' On connect the sid is saved in the connected sessions list.
 | 
				
			||||||
    '''
 | 
					    '''
 | 
				
			||||||
    socketio_sessions.append(request.sid)
 | 
					    sessions.append(request.sid)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@socketio.on('disconnect')
 | 
					@socketio.on('disconnect')
 | 
				
			||||||
@@ -34,7 +34,7 @@ def socketio_disconnect():
 | 
				
			|||||||
    ' list.
 | 
					    ' list.
 | 
				
			||||||
    '''
 | 
					    '''
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        socketio_sessions.remove(request.sid)
 | 
					        sessions.remove(request.sid)
 | 
				
			||||||
    except ValueError:
 | 
					    except ValueError:
 | 
				
			||||||
        pass
 | 
					        pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
from datetime import datetime
 | 
					from datetime import datetime
 | 
				
			||||||
from . import db, socketio
 | 
					from .. import db, socketio
 | 
				
			||||||
from .models import Corpus, CorpusFile, Job, JobInput, JobResult
 | 
					from ..models import Corpus, CorpusFile, Job, JobInput, JobResult
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
###############################################################################
 | 
					###############################################################################
 | 
				
			||||||
		Reference in New Issue
	
	Block a user