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.
PR Checklist
CONTRIBUTING.md
?Here I add
exclude_opt_key
to all middlewares (logging, rate_limiting) and do some code cleanup by reusing code either from utils or AbstractMiddleware where applicable, fixing typos in docstrings and unifying parameter typing.I need to write a few tests (while we have tests for exclusion for AbstractMiddleware we need to make sure that params from config are properly wired to init args and we need at least one test per middleware for that) and update docs that all builtin middleware support exclusion via pattern list or opt key
Also, there is another question that needs to be discussed I think.
At the moment
AbstractAuthenticationMiddleware
usesexclude_from_auth_key
param with the default value ofexclude_from_auth
.CSRFMiddleware
usesexclude_from_csrf_key
config property (default value isexclude_from_csrf
) and session middleware hasexclude_opt_key
config prop with the default value ofskip_session
. All other middleware useexclude_opt_key
param withNone
as its default value.While having default value is ok for a middleware that users want to disable often (I think turning off CSRF or Auth happens more frequently than disabling logging on some handlers) but I think it would be great to be consistent with param name. So what do you think about deprecation and switching in the future to the same param name?