Skip to content

refactor server.py for using Blueprint#3033

Open
JanEisermann wants to merge 90 commits into
Open-MSS:developfrom
JanEisermann:inkludingBP
Open

refactor server.py for using Blueprint#3033
JanEisermann wants to merge 90 commits into
Open-MSS:developfrom
JanEisermann:inkludingBP

Conversation

@JanEisermann

@JanEisermann JanEisermann commented Mar 13, 2026

Copy link
Copy Markdown
Collaborator

Purpose of PR?:

Fixes #2081

Does this PR introduce a breaking change?
included Blueprint, fixed test_load_no_file

If the changes in this PR are manually verified, list down the scenarios covered::
tests succeed, not manually verified

Additional information for reviewer? :
Mention if this PR is part of any design or a continuation of previous PRs

Does this PR results in some Documentation changes?
If yes, include the list of Documentation changes

Checklist:

  • Bug fix. Fixes #
  • New feature (Non-API breaking changes that adds functionality)
  • PR Title follows the convention of <type>: <subject>
  • Commit has unit tests

@JanEisermann JanEisermann changed the title Inkluding bp Inkcuding bp Mar 13, 2026
@JanEisermann JanEisermann changed the title Inkcuding bp Including bp Mar 13, 2026
@JanEisermann JanEisermann changed the title Including bp refactor server.py for using Blueprint Mar 13, 2026
Comment thread mslib/mswms/app/__init__.py Outdated
Comment thread mslib/mscolab/app/__init__.py Outdated
Comment thread mslib/mscolab/app/__init__.py Outdated
Comment thread mslib/mswms/app/__init__.py Outdated
Comment thread mslib/mswms/app/__init__.py Outdated
Comment thread mslib/mscolab/server.py Outdated
Comment thread mslib/mscolab/app/__init__.py Outdated
Comment thread mslib/mscolab/blueprints/chat/chat.py Outdated
Comment thread mslib/mscolab/blueprints/chat/chat.py Outdated
Comment thread mslib/mscolab/blueprints/chat/chat.py Outdated
Comment thread mslib/mscolab/blueprints/chat/chat.py Outdated
Comment thread mslib/mscolab/blueprints/operation/__init__.py
Comment thread mslib/mscolab/blueprints/auth/auth.py
Comment thread mslib/mscolab/blueprints/auth/auth.py Outdated
Comment thread mslib/mswms/app/__init__.py Outdated
Comment thread mslib/utils/file_exists.py Outdated

@ReimarBauer ReimarBauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's good progress. We can already see it's becoming much more readable. You need to rearrange a few things.

The blueprints should contain as few additional functions as possible.

Especially not ones that need to be imported from other blueprints.

see comments

Comment thread mslib/mscolab/blueprints/auth/__init__.py
Comment thread mslib/mscolab/blueprints/docs/__init__.py Outdated
Comment thread mslib/mscolab/server.py Outdated
Comment thread mslib/mscolab/server.py Outdated
Comment thread mslib/mscolab/server.py Outdated
Comment thread mslib/mscolab/blueprints/docs/templates/footer.html
Comment thread mslib/mscolab/blueprints/docs/templates/theme.html
Comment thread mslib/mswms/app/__init__.py

@ReimarBauer ReimarBauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a comprehensive structural refactoring that has been very well implemented in large parts. Nevertheless, I have noticed some points that could lead to immediate problems during deployment. Additionally, some regressions have occurred; I should have checked these more thoroughly during my initial review.

Comment thread mslib/mswms/app/__init__.py Outdated
Comment thread mslib/mscolab/blueprints/auth/__init__.py Outdated
Comment thread mslib/mscolab/blueprints/auth/__init__.py
Comment thread mslib/mscolab/blueprints/auth/__init__.py
Comment thread mslib/mscolab/blueprints/chat/__init__.py Outdated
Comment thread mslib/mswms/blueprints/docs/__init__.py Outdated
Comment thread mslib/mscolab/app/__init__.py Outdated
Comment thread mslib/mscolab/auth.py Outdated
Comment thread tests/_test_mscolab/test_server_auth_required.py Outdated
Comment thread tests/_test_mscolab/test_server_auth_required.py Outdated
Comment thread mslib/mswms/app/__init__.py Outdated
Comment thread mslib/mswms/app/__init__.py
Comment thread tests/_test_mscolab/test_server_auth_required.py Outdated
Comment thread tests/_test_mscolab/test_server_auth_required.py Outdated
@@ -43,15 +45,15 @@ def setup(self, mscolab_app):
self.userdata = 'UV10@uv10', 'UV10', 'uv10', 'User UV'

@ReimarBauer ReimarBauer Jun 22, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# enable basic auth
self.app.config['ENABLE_BASIC_HTTP_AUTHENTICATION'] = True
yield     
self.app.config['ENABLE_BASIC_HTTP_AUTHENTICATION'] = False

Comment thread mslib/mscolab/server.py Outdated
Comment thread mslib/mscolab/blueprints/auth/templates/auth/user/status_password.html Outdated
Comment thread mslib/mscolab/server.py Outdated
try:
from mslib.mscolab.server import authfunc, verify_pw, initialize_managers, get_auth_token, register_user
from mslib.mscolab.server import authfunc, verify_pw, _initialize_managers
from mslib.mscolab.blueprints.auth import get_auth_token

@ReimarBauer ReimarBauer Jun 22, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when you use with self.app.test_client() as test_client: and call the server by a post request,
you don't need
from mslib.mscolab.blueprints.auth import get_auth_token
from mslib.mscolab.auth import register_user
both can become removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor server.py for using Blueprint

3 participants