Add support for middleware to extensions
Review Request #4530 — Created Sept. 5, 2013 and submitted
Information | |
---|---|
mcote | |
Djblets | |
master | |
4563 | |
Reviewers | |
djblets | |
smacleod |
Add support for middleware in extensions.
All unit tests pass.
Description | From | Last Updated |
---|---|---|
Hm... so it sounds like we'd be generating this list pretty much every time the MiddlewareRunner was hit... Could we … |
|
|
Maybe "_recalculate_middleware?" |
|
|
What is "this" and "dependencies" in theis context? Not sure this paragraph is describing the function. |
|
|
Blank line between statements and for/if/etc. statements that form blocks. |
|
|
Should be _get_extension_middleware. |
|
|
I'd recommend specifying that this is a utility function for _set_middleware, and describe how it's used/what it does, since it … |
|
|
Blank around each of htese. |
|
|
Blank before this. |
|
|
And before this. |
|
|
And before this. |
|
|
I don't see where this is used. The class should have a docstring going into detail on what this is … |
|
|
Blank line before. |
|
|
And here. |
|
|
And here. |
|
|
And here. |
|
|
And here. |
|
|
And here. |
|
|
And here. |
|
|
And here. |
|
|
It might be worth documenting here that this class needs to be added to the settings.py MIDDLEWARE_CLASSES for the extension … |
SM smacleod | |
Mark should go before Micah. |
|

-
This is a review from Review Bot.
Tool: Pyflakes
Processed Files:
djblets/extensions/base.py
djblets/extensions/middleware.py
Ignored Files:
AUTHORS
-
-
djblets/extensions/middleware.py (Diff revision 1) Hm... so it sounds like we'd be generating this list pretty much every time the MiddlewareRunner was hit...
Could we not have the ExtensionManager maintain this list of middleware, and add / remove to it when extensions are enabled and disabled? This way, we wouldn't need to generate it each time.
Or am I missing a case?
Change Summary:
Updated with mconley's suggestion: creation and ownership of the middleware list is now in ExtensionManager instead of in ExtensionMiddlewareRunner.
Diff: |
Revision 2 (+83) |
---|

-
This is a review from Review Bot.
Tool: PEP8 Style Checker
Processed Files:
djblets/extensions/base.py
djblets/extensions/middleware.py
Ignored Files:
AUTHORS

-
This is a review from Review Bot.
Tool: Pyflakes
Processed Files:
djblets/extensions/base.py
djblets/extensions/middleware.py
Ignored Files:
AUTHORS
Change Summary:
Cleaning up description.
Description: |
|
---|
-
-
-
djblets/extensions/base.py (Diff revision 2) What is "this" and "dependencies" in theis context? Not sure this paragraph is describing the function.
-
djblets/extensions/base.py (Diff revision 2) Blank line between statements and for/if/etc. statements that form blocks.
-
-
djblets/extensions/base.py (Diff revision 2) I'd recommend specifying that this is a utility function for _set_middleware, and describe how it's used/what it does, since it has to operate within _set_middleware.
-
-
-
-
-
djblets/extensions/middleware.py (Diff revision 2) I don't see where this is used.
The class should have a docstring going into detail on what this is for.
Same with all the functions within.
-
-
-
-
-
-
-
-
Change Summary:
New patch addressing issues. I also noticed that ExtensionManager._recalculate_middleware() was still being called on every page load because ExtensionManager.load() also is, so I modified the latter to only call the former if an extension is added or removed.
Diff: |
Revision 3 (+116) |
---|

-
This is a review from Review Bot.
Tool: PEP8 Style Checker
Processed Files:
djblets/extensions/base.py
djblets/extensions/middleware.py
Ignored Files:
AUTHORS

-
This is a review from Review Bot.
Tool: Pyflakes
Processed Files:
djblets/extensions/base.py
djblets/extensions/middleware.py
Ignored Files:
AUTHORS
-
Just a nit about some documentation, otherwise it looks good to me!
-
djblets/extensions/middleware.py (Diff revision 3) It might be worth documenting here that this class needs to be added to the settings.py
MIDDLEWARE_CLASSES for the extension middleware to be run.

-
This is a review from Review Bot.
Tool: PEP8 Style Checker
Processed Files:
djblets/extensions/base.py
djblets/extensions/middleware.py
Ignored Files:
AUTHORS

-
This is a review from Review Bot.
Tool: Pyflakes
Processed Files:
djblets/extensions/base.py
djblets/extensions/middleware.py
Ignored Files:
AUTHORS

-
This is a review from Review Bot.
Tool: PEP8 Style Checker
Processed Files:
djblets/extensions/base.py
djblets/extensions/middleware.py
Ignored Files:
AUTHORS