From 83b14bef612480fb1381b3f432cef356fef913b7 Mon Sep 17 00:00:00 2001 From: Marcus Oskarsson Date: Wed, 20 Sep 2023 13:49:48 +0200 Subject: [PATCH] Raising not implemented error on instanciation --- mxcube3/app.py | 5 +++++ mxcube3/server.py | 15 +++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/mxcube3/app.py b/mxcube3/app.py index 0372a225b..2745c0a7c 100644 --- a/mxcube3/app.py +++ b/mxcube3/app.py @@ -246,6 +246,11 @@ class MXCUBEApplication: server = None + def __init__(self): + raise NotImplementedError( + "MXCUBEApplication is to be used as a pure static class, dont instanciate" + ) + @staticmethod def init( server, allow_remote, ra_timeout, log_fpath, log_level, enabled_logger_list, cfg diff --git a/mxcube3/server.py b/mxcube3/server.py index 97f98f2a8..d167526ab 100644 --- a/mxcube3/server.py +++ b/mxcube3/server.py @@ -31,6 +31,11 @@ class Server: db_session = None flask_socketio = None + def __init__(self): + raise NotImplementedError( + "Server is to be used as a pure static class, dont instanciate" + ) + @staticmethod def exception_handler(e): err_msg = "Uncaught exception while calling %s" % request.path @@ -177,10 +182,7 @@ def register_routes(mxcube): init_gphl_workflow_route, mxcube, f"{url_root_prefix}/gphl_workflow" ) - Server.security = flask_security.Security( - Server.flask, - Server.user_datastore - ) + Server.security = flask_security.Security(Server.flask, Server.user_datastore) @staticmethod def emit(*args, **kwargs): @@ -201,10 +203,7 @@ def run(cfg): if ssl_context: Server.flask_socketio.run( - Server.flask, - ssl_context=ssl_context, - host="0.0.0.0", - port=8081 + Server.flask, ssl_context=ssl_context, host="0.0.0.0", port=8081 ) else: Server.flask_socketio.run(Server.flask, host="0.0.0.0", port=8081)