refactor: standardize root_path access to settings.app_root_path#3875
Open
Yosiefeyob wants to merge 1 commit intomainfrom
Open
refactor: standardize root_path access to settings.app_root_path#3875Yosiefeyob wants to merge 1 commit intomainfrom
Yosiefeyob wants to merge 1 commit intomainfrom
Conversation
Signed-off-by: Yosief Eyob <yosiefogbazion@gmail.com>
cee6974 to
35fc1b3
Compare
Member
|
Thanks @Yosiefeyob. Clean refactor — using |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Related Issue
Closes #1588
📝 Summary
What does this PR do and why?
Replaces all request.scope.get("root_path", "") calls with settings.app_root_path across files.
Redirect URLs to
/adminwere also updated to use a consistent trailing slash (/admin/) to avoid unnecessary 307 redirects from FastAPI's path normalization.Tests were updated to patch
settings.app_root_pathdirectly instead of injecting root_path via the request scope, which aligns with the new standardized pattern and makes tests easier to maintain.The existing _resolve_root_path helper in admin.py was preserved as-is since it intentionally reads from the request scope first (for proxy/mounted deployments) and falls back to settings.app_root_path — this links to PR #1547.
🏷️ Type of Change
🧪 Verification
make lintmake testmake coverage✅ Checklist
make black isort pre-commit)