-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix: Async support and middleware update for django CMS 4.2+ #8147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's Guide by SourceryThis pull request removes the Updated class diagram for ToolbarMiddlewareclassDiagram
class ToolbarMiddleware {
+__init__(get_response)
+is_edit_mode(request)
+process_request(request)
+process_response(request, response)
+__call__(request)
+__acall__(request)
}
Updated class diagram for ApphookReloadMiddlewareclassDiagram
class ApphookReloadMiddleware {
+__init__(get_response)
+__call__(request)
+__acall__(request)
}
Updated class diagram for LanguageCookieMiddlewareclassDiagram
class LanguageCookieMiddleware {
+__init__(get_response)
+__call__(request)
+__acall__(request)
+process_response(request, response)
}
Updated class diagram for CurrentPageMiddlewareclassDiagram
class CurrentPageMiddleware {
+__init__(get_response)
+__call__(request)
+__acall__(request)
}
Updated class diagram for CurrentUserMiddlewareclassDiagram
class CurrentUserMiddleware {
+async_capable
+__init__(get_response)
+__call__(request)
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @fsbraun - I've reviewed your changes - here's some feedback:
Overall Comments:
- It looks like you've removed
MiddlewareMixin
and added__call__
and__acall__
methods to support both synchronous and asynchronous requests, which is great. However, you're callingself.process_request
andself.process_response
in both__call__
and__acall__
. Consider if these methods need to be async as well. - The
CurrentUserMiddleware
hasasync_capable = False
, but the other middlewares don't. Should this be explicitly set toTrue
on the other middlewares?
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@fsbraun This is some great work. Thank you. Looks good, merging it. |
Description
This PR removes the use of the compatibility
MiddlewareMixin
which is a tool to migrate old-style middleware to new-style middleware.Except user middleware (which sets affects the current thread) all middlewares should in principle support async calls.
Related resources
Checklist
develop-4