Move named url init out of Middleware init#15085
Merged
chrismeyersfsu merged 1 commit intoApr 10, 2024
Merged
Conversation
chrismeyersfsu
commented
Apr 9, 2024
|
|
||
|
|
||
| def _dfs(configuration, model, graph, dead_ends, new_deadends, parents): | ||
| from django.contrib.contenttypes.models import ContentType |
Member
Author
There was a problem hiding this comment.
named_url_graph.py is now imported and used in the app ready path. This is a bootstrapping phase and like any bootstrapping phase all the facilities aren't initialized. We have to be careful of what we import and when.
Delays this import.
chrismeyersfsu
commented
Apr 9, 2024
|
|
||
|
|
||
| def _customize_graph(): | ||
| from django.contrib.auth.models import User |
Member
Author
There was a problem hiding this comment.
Delay User import.
AlanCoding
approved these changes
Apr 10, 2024
* Middleware classes can be instantiated multiple times in testing. To make this a non-issue, move the init code for named urls out of the middleware init and into the app init. * This makes it easier to use other testing facilities, like LiveServerTestCase, without having to mock the named url middleware init.
46bc5a0 to
956af4a
Compare
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.
SUMMARY
ISSUE TYPE
COMPONENT NAME
AWX VERSION
ADDITIONAL INFORMATION