Skip to content

Commit

Permalink
Raising not implemented error on instanciation
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-oscarsson committed Sep 20, 2023
1 parent 012b86c commit 83b14be
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
5 changes: 5 additions & 0 deletions mxcube3/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 7 additions & 8 deletions mxcube3/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand All @@ -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)

0 comments on commit 83b14be

Please sign in to comment.