Refactor create_app in airflow/www/app.py#9291
Merged
mik-laj merged 12 commits intoapache:masterfrom Jun 14, 2020
Merged
Conversation
added 10 commits
June 14, 2020 17:32
9965f52 to
85edd82
Compare
kaxil
reviewed
Jun 14, 2020
|
|
||
| def init_xframe_protection(app): | ||
| """ | ||
| Add X-Frame-Options header. Use it avoid click-jacking attacks, by ensuring that their content is not |
Member
There was a problem hiding this comment.
Suggested change
| Add X-Frame-Options header. Use it avoid click-jacking attacks, by ensuring that their content is not | |
| Add X-Frame-Options header. Use it to avoid click-jacking attacks, by ensuring that their content is not |
kaxil
reviewed
Jun 14, 2020
airflow/www/extensions/init_views.py
Outdated
Comment on lines
108
to
118
| from airflow.www.api.experimental import endpoints as e | ||
|
|
||
| # required for testing purposes otherwise the module retains | ||
| # a link to the default_auth | ||
| if app.config['TESTING']: | ||
| import importlib | ||
|
|
||
| importlib.reload(e) | ||
|
|
||
| app.register_blueprint(e.api_experimental, url_prefix='/api/experimental') | ||
| app.extensions['csrf'].exempt(e.api_experimental) |
Member
There was a problem hiding this comment.
It is just used at 2 places so I think the following might be better, WDYT?
Suggested change
| from airflow.www.api.experimental import endpoints as e | |
| # required for testing purposes otherwise the module retains | |
| # a link to the default_auth | |
| if app.config['TESTING']: | |
| import importlib | |
| importlib.reload(e) | |
| app.register_blueprint(e.api_experimental, url_prefix='/api/experimental') | |
| app.extensions['csrf'].exempt(e.api_experimental) | |
| from airflow.www.api.experimental import endpoints | |
| # required for testing purposes otherwise the module retains | |
| # a link to the default_auth | |
| if app.config['TESTING']: | |
| import importlib | |
| importlib.reload(endpoints) | |
| app.register_blueprint(e.api_experimental, url_prefix='/api/experimental') | |
| app.extensions['csrf'].exempt(endpoints.api_experimental) |
Member
Author
There was a problem hiding this comment.
Agree. We don't need an alias here.
Member
Author
|
@kaxil Fixed. Thank you so much for the quick review. |
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.
This function was too long. It was very difficult to trace how it works. I divided it into 15 functions in 7 modules, which I am sure will facilitate its development. This file was also excluded from pylint_todo, so I fixed it to prevent regression.
Make sure to mark the boxes below before creating PR: [x]
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.
Read the Pull Request Guidelines for more information.