Add support for middleware to extensions
Review Request #4530 — Created Sept. 5, 2013 and submitted
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 … |
mike_conley | |
Maybe "_recalculate_middleware?" |
chipx86 | |
What is "this" and "dependencies" in theis context? Not sure this paragraph is describing the function. |
chipx86 | |
Blank line between statements and for/if/etc. statements that form blocks. |
chipx86 | |
Should be _get_extension_middleware. |
chipx86 | |
I'd recommend specifying that this is a utility function for _set_middleware, and describe how it's used/what it does, since it … |
chipx86 | |
Blank around each of htese. |
chipx86 | |
Blank before this. |
chipx86 | |
And before this. |
chipx86 | |
And before this. |
chipx86 | |
I don't see where this is used. The class should have a docstring going into detail on what this is … |
chipx86 | |
Blank line before. |
chipx86 | |
And here. |
chipx86 | |
And here. |
chipx86 | |
And here. |
chipx86 | |
And here. |
chipx86 | |
And here. |
chipx86 | |
And here. |
chipx86 | |
And here. |
chipx86 | |
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. |
mike_conley |
-
This is a review from Review Bot.
Tool: Pyflakes
Processed Files:
djblets/extensions/base.py
djblets/extensions/middleware.py
Ignored Files:
AUTHORS
-
-
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.
-
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:
-
~ This adds support for middleware to djblets extensions. To enable in ReviewBoard, you just have to add 'djblets.extensions.middleware.ExtensionsMiddlewareRunner' to the end of the MIDDLEWARE_CLASSES list in reviewboard/settings.py (will put that up in a separate patch once this patch is merged in).
~ Add support for middleware in extensions.
- - I didn't add any tests as it seemed rather difficult to mock up something that runs all the middleware functions. Suggestions welcome if there's a decent mechanism that I don't know of. :)
-
-
-
What is "this" and "dependencies" in theis context? Not sure this paragraph is describing the function.
-
-
-
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.
-
-
-
-
-
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.
-
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
-
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